PHP Interface Laratrust\Contracts\LaratrustUserInterface

Afficher le fichier Open project: santigarcor/laratrust

Méthodes publiques

Méthode Description
ability ( string | array $roles, string | array $permissions, string | boolean $group = null, array $options = [] ) : array | boolean Checks role(s) and permission(s).
attachPermission ( mixed $permission ) Alias to eloquent many-to-many relation's attach() method.
attachPermissions ( mixed $permissions ) Attach multiple permissions to a user
attachRole ( mixed $role, string $group = null ) Alias to eloquent many-to-many relation's attach() method.
attachRoles ( mixed $roles, string $group = null ) Attach multiple roles to a user
can ( string | array $permission, string | boolean $group = null, boolean $requireAll = false ) : boolean Check if user has a permission by its name.
detachPermission ( mixed $permission ) Alias to eloquent many-to-many relation's detach() method.
detachPermissions ( mixed $permissions ) Detach multiple permissions from a user
detachRole ( mixed $role, string $group = null ) Alias to eloquent many-to-many relation's detach() method.
detachRoles ( mixed $roles, string $group = null ) Detach multiple roles from a user
hasRole ( string | array $name, string | boolean $group = null, boolean $requireAll = false ) : boolean Checks if the user has a role by its name.
permissions ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany Many-to-Many relations with Role.
roles ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany Many-to-Many relations with Role.

Method Details

ability() public méthode

Checks role(s) and permission(s).
public ability ( string | array $roles, string | array $permissions, string | boolean $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.
$group string | boolean Group or options value
$options array validate_all (true|false) or return_type (boolean|array|both)
Résultat array | boolean

attachPermission() public méthode

Alias to eloquent many-to-many relation's attach() method.
public attachPermission ( mixed $permission )
$permission mixed

attachPermissions() public méthode

Attach multiple permissions to a user
public attachPermissions ( mixed $permissions )
$permissions mixed

attachRole() public méthode

Alias to eloquent many-to-many relation's attach() method.
public attachRole ( mixed $role, string $group = null )
$role mixed
$group string

attachRoles() public méthode

Attach multiple roles to a user
public attachRoles ( mixed $roles, string $group = null )
$roles mixed
$group string

can() public méthode

Check if user has a permission by its name.
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 or requireAll value
$requireAll boolean All permissions in the array are required.
Résultat boolean

detachPermission() public méthode

Alias to eloquent many-to-many relation's detach() method.
public detachPermission ( mixed $permission )
$permission mixed

detachPermissions() public méthode

Detach multiple permissions from a user
public detachPermissions ( mixed $permissions )
$permissions mixed

detachRole() public méthode

Alias to eloquent many-to-many relation's detach() method.
public detachRole ( mixed $role, string $group = null )
$role mixed
$group string

detachRoles() public méthode

Detach multiple roles from a user
public detachRoles ( mixed $roles, string $group = null )
$roles mixed
$group string

hasRole() public méthode

Checks if the user has a role by its name.
public hasRole ( string | array $name, string | boolean $group = null, boolean $requireAll = false ) : boolean
$name string | array Role name or array of role names.
$group string | boolean Group or requireAll value
$requireAll boolean All roles in the array are required.
Résultat boolean

permissions() public méthode

Many-to-Many relations with Role.
public permissions ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
Résultat Illuminate\Database\Eloquent\Relations\BelongsToMany

roles() public méthode

Many-to-Many relations with Role.
public roles ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
Résultat Illuminate\Database\Eloquent\Relations\BelongsToMany