PHP Trait app\HasRoles

Show file Open project: appzcoder/laravel-admin

Public Methods

Method Description
assignRole ( string $role ) : mixed Assign the given role to the user.
hasPermission ( Permission $permission ) : boolean Determine if the user may perform the given permission.
hasRole ( mixed $role ) : boolean Determine if the user has the given role.
roles ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany A user may have multiple roles.

Method Details

assignRole() public method

Assign the given role to the user.
public assignRole ( string $role ) : mixed
$role string
return mixed

hasPermission() public method

Determine if the user may perform the given permission.
public hasPermission ( Permission $permission ) : boolean
$permission Permission
return boolean

hasRole() public method

Determine if the user has the given role.
public hasRole ( mixed $role ) : boolean
$role mixed
return boolean

roles() public method

A user may have multiple roles.
public roles ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
return Illuminate\Database\Eloquent\Relations\BelongsToMany