Method | Description | |
---|---|---|
ability ( string | array $roles, string | array $permissions, $group = null, array $options = [] ) : array | boolean | Checks role(s) and permission(s). | |
attachPermission ( mixed $permission ) : Illuminate\Database\Eloquent\Model | Alias to eloquent many-to-many relation's attach() method. | |
attachPermissions ( mixed $permissions ) : Illuminate\Database\Eloquent\Model | Attach multiple permissions to a user | |
attachRole ( mixed $role, $group = null ) : Illuminate\Database\Eloquent\Model | Alias to eloquent many-to-many relation's attach() method. | |
attachRoles ( mixed $roles, $group = null ) : Illuminate\Database\Eloquent\Model | Attach multiple roles to a user | |
bootLaratrustUserTrait ( ) : void | boolean | Boot the user model Attach event listener to remove the many-to-many records when trying to delete Will NOT delete any records if the user model uses soft deletes. | |
cachedPermissions ( ) : Illuminate\Database\Eloquent\Collection | Tries to return all the cached permissions of the user and if it can't bring the permissions from the cache, it would bring them back from the DB | |
cachedRoles ( ) : Illuminate\Database\Eloquent\Collection | Tries to return all the cached roles of the user and if it can't bring the roles from the cache, it would bring them back from the DB | |
can ( string | array $permission, string | boolean $group = null, boolean $requireAll = false ) : boolean | Check if user has a permission by its name. | |
detachPermission ( mixed $permission ) : Illuminate\Database\Eloquent\Model | Alias to eloquent many-to-many relation's detach() method. | |
detachPermissions ( mixed $permissions = null ) : Illuminate\Database\Eloquent\Model | Detach multiple permissions from a user | |
detachRole ( mixed $role, $group = null ) : Illuminate\Database\Eloquent\Model | Alias to eloquent many-to-many relation's detach() method. | |
detachRoles ( mixed $roles = null, $group = null ) : Illuminate\Database\Eloquent\Model | Detach multiple roles from a user | |
flushCache ( ) : void | Flush the user's cache | |
groups ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany | Many-to-Many relations with Group. | |
hasRole ( string | array $name, string | boolean $group = null, boolean $requireAll = false ) : boolean | Checks if the user has a role by its name. | |
owns ( Model $thing ) : boolean | Checks if the user owns the thing | |
permissions ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany | Many-to-Many relations with Permission. | |
roles ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany | Many-to-Many relations with Role. | |
scopeWherePermissionIs ( Illuminate\Database\Eloquent\Builder $query, string $permission = '' ) : Illuminate\Database\Eloquent\Builder | This scope allows to retrive users with an specific permission | |
scopeWhereRoleIs ( Illuminate\Database\Eloquent\Builder $query, string $role = '' ) : Illuminate\Database\Eloquent\Builder | This scope allows to retrive users with an specific role |
public ability ( string | array $roles, string | array $permissions, $group = null, array $options = [] ) : array | boolean | ||
$roles | string | array | Array of roles or comma separated string |
$permissions | string | array | Array of permissions or comma separated string. |
$options | array | validate_all (true|false) or return_type (boolean|array|both) |
return | array | boolean |
public attachPermission ( mixed $permission ) : Illuminate\Database\Eloquent\Model | ||
$permission | mixed | |
return | Illuminate\Database\Eloquent\Model |
public attachPermissions ( mixed $permissions ) : Illuminate\Database\Eloquent\Model | ||
$permissions | mixed | |
return | Illuminate\Database\Eloquent\Model |
public attachRole ( mixed $role, $group = null ) : Illuminate\Database\Eloquent\Model | ||
$role | mixed | |
return | Illuminate\Database\Eloquent\Model |
public attachRoles ( mixed $roles, $group = null ) : Illuminate\Database\Eloquent\Model | ||
$roles | mixed | |
return | Illuminate\Database\Eloquent\Model |
public static bootLaratrustUserTrait ( ) : void | boolean | ||
return | void | boolean |
public cachedPermissions ( ) : Illuminate\Database\Eloquent\Collection | ||
return | Illuminate\Database\Eloquent\Collection |
public cachedRoles ( ) : Illuminate\Database\Eloquent\Collection | ||
return | Illuminate\Database\Eloquent\Collection |
public can ( string | array $permission, string | boolean $group = null, boolean $requireAll = false ) : boolean | ||
$permission | string | array | Permission string or array of permissions. |
$group | string | boolean | Group name or requiredAll roles. |
$requireAll | boolean | All permissions in the array are required. |
return | boolean |
public detachPermission ( mixed $permission ) : Illuminate\Database\Eloquent\Model | ||
$permission | mixed | |
return | Illuminate\Database\Eloquent\Model |
public detachPermissions ( mixed $permissions = null ) : Illuminate\Database\Eloquent\Model | ||
$permissions | mixed | |
return | Illuminate\Database\Eloquent\Model |
public detachRole ( mixed $role, $group = null ) : Illuminate\Database\Eloquent\Model | ||
$role | mixed | |
return | Illuminate\Database\Eloquent\Model |
public detachRoles ( mixed $roles = null, $group = null ) : Illuminate\Database\Eloquent\Model | ||
$roles | mixed | |
return | Illuminate\Database\Eloquent\Model |
public groups ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany | ||
return | Illuminate\Database\Eloquent\Relations\BelongsToMany |
public permissions ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany | ||
return | Illuminate\Database\Eloquent\Relations\BelongsToMany |
public roles ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany | ||
return | Illuminate\Database\Eloquent\Relations\BelongsToMany |
public scopeWherePermissionIs ( Illuminate\Database\Eloquent\Builder $query, string $permission = '' ) : Illuminate\Database\Eloquent\Builder | ||
$query | Illuminate\Database\Eloquent\Builder | |
$permission | string | |
return | Illuminate\Database\Eloquent\Builder |
public scopeWhereRoleIs ( Illuminate\Database\Eloquent\Builder $query, string $role = '' ) : Illuminate\Database\Eloquent\Builder | ||
$query | Illuminate\Database\Eloquent\Builder | |
$role | string | |
return | Illuminate\Database\Eloquent\Builder |