Gate
class Gate implements Gate (View source)
Traits
Methods
Create a new gate instance.
Determine if a given ability has been defined.
Define a new ability.
Define a policy class for a given class type.
Register a callback to run before all Gate checks.
Register a callback to run after all Gate checks.
Determine if the given ability should be granted for the current user.
Determine if the given ability should be denied for the current user.
Determine if the given ability should be granted for the current user.
Determine if the given ability should be granted for the current user.
Get a policy instance for a given class.
Build a policy class instance of the given type.
Details
at line line 67
void
__construct(
Container $container,
callable $userResolver,
array $abilities = array(),
array $policies = array(),
array $beforeCallbacks = array(),
array $afterCallbacks = array())
Create a new gate instance.
at line line 132
$this
policy(
string $class,
string $policy)
Define a policy class for a given class type.
at line line 145
$this
before(
callable $callback)
Register a callback to run before all Gate checks.
at line line 172
bool
allows(
string $ability,
array|mixed $arguments = array())
Determine if the given ability should be granted for the current user.
at line line 184
bool
denies(
string $ability,
array|mixed $arguments = array())
Determine if the given ability should be denied for the current user.
at line line 196
bool
check(
string $ability,
array|mixed $arguments = array())
Determine if the given ability should be granted for the current user.
at line line 216
Response
authorize(
string $ability,
array|mixed $arguments = array())
Determine if the given ability should be granted for the current user.
at line line 421
mixed
resolvePolicy(
object|string $class)
Build a policy class instance of the given type.
at line line 432
Gate
forUser(
Authenticatable|mixed $user)
Get a guard instance for the given user.