Gate
interface Gate (View source)
Methods
Determine if a given ability has been defined.
Define a new ability.
Define abilities for a resource.
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 all of the given abilities should be granted for the current user.
Determine if any of the given abilities should be denied for the current user.
Determine if all of the given abilities should be granted for the current user.
Determine if any one of the given abilities should be granted for the current user.
Determine if the given ability should be granted for the current user.
Inspect the user for the given ability.
Get the raw result from the authorization callback.
Get a policy instance for a given class.
Get all of the defined abilities.
Details
$this
resource(string $name, string $class, array|null $abilities = null)
Define abilities for a resource.
bool
allows(iterable|string $ability, array|mixed $arguments = [])
Determine if all of the given abilities should be granted for the current user.
bool
denies(iterable|string $ability, array|mixed $arguments = [])
Determine if any of the given abilities should be denied for the current user.
bool
check(iterable|string $abilities, array|mixed $arguments = [])
Determine if all of the given abilities should be granted for the current user.
bool
any(iterable|string $abilities, array|mixed $arguments = [])
Determine if any one of the given abilities should be granted for the current user.
Response
authorize(string $ability, array|mixed $arguments = [])
Determine if the given ability should be granted for the current user.
Response
inspect(string $ability, array|mixed $arguments = [])
Inspect the user for the given ability.