get()->pluck('name', 'id'); } /** * The Users relationship. * * @return \Illuminate\Database\Eloquent\Relations\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) { $this->attributes['permissions'] = Permission::prepare($permissions); } /** * Get table data for the resource * * @return \Illuminate\Http\JsonResponse */ public function table() { return new AdminTable($this->newQuery()); } }