PHP Interface Laratrust\Contracts\LaratrustUserInterface

Mostrar archivo Open project: santigarcor/laratrust

Public Methods

Method 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 method

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)
return array | boolean

attachPermission() public method

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

attachPermissions() public method

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

attachRole() public method

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

attachRoles() public method

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

can() public method

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.
return boolean

detachPermission() public method

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

detachPermissions() public method

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

detachRole() public method

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

detachRoles() public method

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

hasRole() public method

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.
return boolean

permissions() public method

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

roles() public method

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