Gate
Methods
has ( $ability ) : bool
Determine if a given ability has been defined.
Parameters
- $ability string
define ( $ability , $callback ) : $this
Define a new ability.
Parameters
- $ability string
- $callback callable|string
resource ( $name , $class , array $abilities ) : $this
Define abilities for a resource.
Parameters
- $name string
- $class string
- $abilities array|null
policy ( $class , $policy ) : $this
Define a policy class for a given class type.
Parameters
- $class string
- $policy string
before ( callable $callback ) : $this
Register a callback to run before all Gate checks.
Parameters
- $callback callable
after ( callable $callback ) : $this
Register a callback to run after all Gate checks.
Parameters
- $callback callable
allows ( $ability , $arguments ) : bool
Determine if the given ability should be granted for the current user.
Parameters
- $ability string
- $arguments array|mixed
denies ( $ability , $arguments ) : bool
Determine if the given ability should be denied for the current user.
Parameters
- $ability string
- $arguments array|mixed
check ( $abilities , $arguments ) : bool
Determine if all of the given abilities should be granted for the current user.
Parameters
- $abilities iterable|string
- $arguments array|mixed
any ( $abilities , $arguments ) : bool
Determine if any one of the given abilities should be granted for the current user.
Parameters
- $abilities iterable|string
- $arguments array|mixed
authorize ( $ability , $arguments ) : Response
Determine if the given ability should be granted for the current user.
Parameters
- $ability string
- $arguments array|mixed
inspect ( $ability , $arguments ) : Response
Inspect the user for the given ability.
Parameters
- $ability string
- $arguments array|mixed
raw ( $ability , $arguments ) : mixed
Get the raw result from the authorization callback.
Parameters
- $ability string
- $arguments array|mixed
getPolicyFor ( $class ) : mixed
Get a policy instance for a given class.
Parameters
- $class object|string
forUser ( $user ) : static
Get a guard instance for the given user.
Parameters
- $user Authenticatable |mixed
abilities ( ) : array
Get all of the defined abilities.