sarga/packages/Webkul/User/src/Models/Admin.php

49 lines
989 B
PHP
Raw Normal View History

2018-06-20 05:06:27 +00:00
<?php
namespace Webkul\User\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Webkul\User\Models\Role;
class Admin extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
2018-07-02 09:29:27 +00:00
'name', 'email', 'password', 'role_id', 'status',
2018-06-20 05:06:27 +00:00
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* Get the role that owns the admin.
*/
public function role()
{
return $this->belongsTo(Role::class);
}
/**
* Checks if admin has permission to perform certain action.
*
* @param String $permission
* @return Boolean
*/
public function hasPermission($permission)
{
return in_array($permission, $this->role->permissions);
}
}