Gate (Auth\Access)
Gate
class Gate implements Gate (View source)
Traits
HandlesAuthorization |
Methods
void | __construct(Container $container, callable $userResolver, array $abilities = array(), array $policies = array(), array $beforeCallbacks = array(), array $afterCallbacks = array()) Create a new gate instance. | |
bool | has(string $ability) Determine if a given ability has been defined. | |
$this | define(string $ability, callable|string $callback) Define a new ability. | |
$this | resource(string $name, string $class, array $abilities = null) Define abilities for a resource. | |
$this | policy(string $class, string $policy) Define a policy class for a given class type. | |
$this | before(callable $callback) Register a callback to run before all Gate checks. | |
$this | after(callable $callback) Register a callback to run after all Gate checks. | |
bool | allows(string $ability, array|mixed $arguments = array()) Determine if the given ability should be granted for the current user. | |
bool | denies(string $ability, array|mixed $arguments = array()) Determine if the given ability should be denied for the current user. | |
bool | check(string $ability, array|mixed $arguments = array()) Determine if the given ability should be granted for the current user. | |
Response | authorize(string $ability, array|mixed $arguments = array()) Determine if the given ability should be granted for the current user. | |
mixed | getPolicyFor(object|string $class) Get a policy instance for a given class. | |
mixed | resolvePolicy(object|string $class) Build a policy class instance of the given type. | |
Gate | forUser(Authenticatable|mixed $user) Get a gate instance for the given user. | |
array | abilities() Get all of the defined abilities. |
Details
void __construct(Container $container, callable $userResolver, array $abilities = array(), array $policies = array(), array $beforeCallbacks = array(), array $afterCallbacks = array())
Create a new gate instance.
bool has(string $ability)
Determine if a given ability has been defined.
$this define(string $ability, callable|string $callback)
Define a new ability.
$this resource(string $name, string $class, array $abilities = null)
Define abilities for a resource.
$this policy(string $class, string $policy)
Define a policy class for a given class type.
$this before(callable $callback)
Register a callback to run before all Gate checks.
$this after(callable $callback)
Register a callback to run after all Gate checks.
bool allows(string $ability, array|mixed $arguments = array())
Determine if the given ability should be granted for the current user.
bool denies(string $ability, array|mixed $arguments = array())
Determine if the given ability should be denied for the current user.
bool check(string $ability, array|mixed $arguments = array())
Determine if the given ability should be granted for the current user.
Response authorize(string $ability, array|mixed $arguments = array())
Determine if the given ability should be granted for the current user.
mixed getPolicyFor(object|string $class)
Get a policy instance for a given class.
mixed resolvePolicy(object|string $class)
Build a policy class instance of the given type.
Gate forUser(Authenticatable|mixed $user)
Get a gate instance for the given user.
array abilities()
Get all of the defined abilities.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Auth/Access/Gate.html