¨4.0.1¨
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Modules\User\Entities;
|
||||
|
||||
use Modules\Admin\Ui\AdminTable;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Modules\User\Repositories\Permission;
|
||||
use Cartalyst\Sentinel\Roles\EloquentRole;
|
||||
use Modules\Support\Eloquent\Translatable;
|
||||
@@ -26,6 +27,7 @@ class Role extends EloquentRole
|
||||
*/
|
||||
protected $translatedAttributes = ['name'];
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all roles.
|
||||
*
|
||||
@@ -36,20 +38,23 @@ class Role extends EloquentRole
|
||||
return static::select('id')->get()->pluck('name', 'id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The Users relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function users(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'user_roles', 'role_id', 'user_id')->withTimestamps();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set role's permissions.
|
||||
*
|
||||
* @param array $permissions
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPermissionsAttribute(array $permissions)
|
||||
@@ -57,10 +62,11 @@ class Role extends EloquentRole
|
||||
$this->attributes['permissions'] = Permission::prepare($permissions);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get table data for the resource
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function table()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user