%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/kpk/api/app/Models/
Upload File :
Create Path :
Current File : /var/www/html/kpk/api/app/Models/User.php

<?php

namespace App\Models;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Passport\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'surname', 'password', 'username', 'is_enabled', 'role_id'
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function role()
    {
        return $this->belongsTo(Role::Class);
    }

    public function logs(){
        return $this->hasMany(Log::Class);
    }

    public function isAdmin()
    {
        return $this->role->slug == 'admin';
    }
}

Zerion Mini Shell 1.0