PHP Trait Caffeinated\Shinobi\Traits\ShinobiTrait

Datei anzeigen Open project: caffeinated/shinobi

Public Methods

Method Description
__call ( string $method, array $arguments = [] ) : mixed Magic __call method to handle dynamic methods.
assignRole ( integer $roleId = null ) : boolean Assigns the given role to the user.
can ( string $permission, array $arguments = [] ) : boolean Check if user has the given permission.
canAtLeast ( array $permissions ) : boolean Check if user has at least one of the given permissions.
getPermissions ( ) : array | null Get all user role permissions.
getRoles ( ) : array | null Get all user roles.
isRole ( string $slug ) : boolean Checks if the user has the given role.
revokeAllRoles ( ) : boolean Revokes all roles from the user.
revokeRole ( integer $roleId = '' ) : boolean Revokes the given role from the user.
roles ( ) : Illuminate\Database\Eloquent\Model Users can have many roles.
syncRoles ( array $roleIds ) : boolean Syncs the given role(s) with the user.

Method Details

__call() public method

Magic __call method to handle dynamic methods.
public __call ( string $method, array $arguments = [] ) : mixed
$method string
$arguments array
return mixed

assignRole() public method

Assigns the given role to the user.
public assignRole ( integer $roleId = null ) : boolean
$roleId integer
return boolean

can() public method

Check if user has the given permission.
public can ( string $permission, array $arguments = [] ) : boolean
$permission string
$arguments array
return boolean

canAtLeast() public method

Check if user has at least one of the given permissions.
public canAtLeast ( array $permissions ) : boolean
$permissions array
return boolean

getPermissions() public method

Get all user role permissions.
public getPermissions ( ) : array | null
return array | null

getRoles() public method

Get all user roles.
public getRoles ( ) : array | null
return array | null

isRole() public method

Checks if the user has the given role.
public isRole ( string $slug ) : boolean
$slug string
return boolean

revokeAllRoles() public method

Revokes all roles from the user.
public revokeAllRoles ( ) : boolean
return boolean

revokeRole() public method

Revokes the given role from the user.
public revokeRole ( integer $roleId = '' ) : boolean
$roleId integer
return boolean

roles() public method

Users can have many roles.
public roles ( ) : Illuminate\Database\Eloquent\Model
return Illuminate\Database\Eloquent\Model

syncRoles() public method

Syncs the given role(s) with the user.
public syncRoles ( array $roleIds ) : boolean
$roleIds array
return boolean