Rbac
class Rbac
This class is the main entry point of rbac. Usually this the interaction with this class will be done through the Entrust Facade
Properties
Application | $app | Laravel application |
Methods
Create a new confide instance.
Checks if the current user has a role by its name
Check if the current user has a permission by its name 检测当前用户是否有权限
Check if the current user has a role or permission by its name
Get the currently authenticated user or null.
Filters a route for a role or set of roles.
Filters a route for a permission or set of permissions.
Filters a route for role(s) and/or permission(s).
Details
at line 26
__construct(Application $app)
Create a new confide instance.
at line 38
bool
hasRole(string $guard, string|array $role, bool $requireAll = false)
Checks if the current user has a role by its name
at line 55
bool
capable(string $guard, string $permission, bool $requireAll = false)
Check if the current user has a permission by its name 检测当前用户是否有权限
at line 71
bool
ability($guard, array|string $roles, array|string $permissions, array $options = [])
Check if the current user has a role or permission by its name
at line 85
RbacUserContract
user(string $guard)
Get the currently authenticated user or null.
at line 100
mixed
routeNeedsRole(string $route, array|string $roles, mixed $result = null, bool $requireAll = true)
Filters a route for a role or set of roles.
If the third parameter is null then abort with status code 403. Otherwise, the $result is returned.
at line 131
mixed
routeNeedsPermission(string $route, array|string $permissions, mixed $result = null, bool $requireAll = true)
Filters a route for a permission or set of permissions.
If the third parameter is null then abort with status code 403. Otherwise the $result is returned.
at line 163
void
routeNeedsRoleOrPermission(string $route, array|string $roles, array|string $permissions, mixed $result = null, bool $requireAll = false)
Filters a route for role(s) and/or permission(s).
If the third parameter is null then abort with status code 403. Otherwise, the $result is returned.