PHP Трейт Caffeinated\Shinobi\Traits\ShinobiTrait

Показать файл Открыть проект

Открытые методы

Метод Описание
__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.

Описание методов

__call() публичный Метод

Magic __call method to handle dynamic methods.
public __call ( string $method, array $arguments = [] ) : mixed
$method string
$arguments array
Результат mixed

assignRole() публичный Метод

Assigns the given role to the user.
public assignRole ( integer $roleId = null ) : boolean
$roleId integer
Результат boolean

can() публичный Метод

Check if user has the given permission.
public can ( string $permission, array $arguments = [] ) : boolean
$permission string
$arguments array
Результат boolean

canAtLeast() публичный Метод

Check if user has at least one of the given permissions.
public canAtLeast ( array $permissions ) : boolean
$permissions array
Результат boolean

getPermissions() публичный Метод

Get all user role permissions.
public getPermissions ( ) : array | null
Результат array | null

getRoles() публичный Метод

Get all user roles.
public getRoles ( ) : array | null
Результат array | null

isRole() публичный Метод

Checks if the user has the given role.
public isRole ( string $slug ) : boolean
$slug string
Результат boolean

revokeAllRoles() публичный Метод

Revokes all roles from the user.
public revokeAllRoles ( ) : boolean
Результат boolean

revokeRole() публичный Метод

Revokes the given role from the user.
public revokeRole ( integer $roleId = '' ) : boolean
$roleId integer
Результат boolean

roles() публичный Метод

Users can have many roles.
public roles ( ) : Illuminate\Database\Eloquent\Model
Результат Illuminate\Database\Eloquent\Model

syncRoles() публичный Метод

Syncs the given role(s) with the user.
public syncRoles ( array $roleIds ) : boolean
$roleIds array
Результат boolean