AuthorizesRequests

trait AuthorizesRequests (View source)

Methods

Response authorize(mixed $ability, mixed|array $arguments = [])

Authorize a given action against a set of arguments.

Response authorizeForUser(Authenticatable|mixed $user, mixed $ability, mixed|array $arguments = [])

Authorize a given action for a user.

Response authorizeAtGate(Gate $gate, mixed $ability, mixed|array $arguments)

Authorize the request at the given gate.

array parseAbilityAndArguments(mixed $ability, mixed|array $arguments)

Guesses the ability's name if it wasn't provided.

HttpException createGateUnauthorizedException(string $ability, mixed|array $arguments, string $message = 'This action is unauthorized.', Exception $previousException = null)

Throw an unauthorized exception based on gate results.

Details

Response authorize(mixed $ability, mixed|array $arguments = [])

Authorize a given action against a set of arguments.

Parameters

mixed $ability
mixed|array $arguments

Return Value

Response

Exceptions

HttpException

Response authorizeForUser(Authenticatable|mixed $user, mixed $ability, mixed|array $arguments = [])

Authorize a given action for a user.

Parameters

Authenticatable|mixed $user
mixed $ability
mixed|array $arguments

Return Value

Response

Exceptions

HttpException

Response authorizeAtGate(Gate $gate, mixed $ability, mixed|array $arguments)

Authorize the request at the given gate.

Parameters

Gate $gate
mixed $ability
mixed|array $arguments

Return Value

Response

Exceptions

HttpException

protected array parseAbilityAndArguments(mixed $ability, mixed|array $arguments)

Guesses the ability's name if it wasn't provided.

Parameters

mixed $ability
mixed|array $arguments

Return Value

array

protected HttpException createGateUnauthorizedException(string $ability, mixed|array $arguments, string $message = 'This action is unauthorized.', Exception $previousException = null)

Throw an unauthorized exception based on gate results.

Parameters

string $ability
mixed|array $arguments
string $message
Exception $previousException

Return Value

HttpException

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.1/Illuminate/Foundation/Auth/Access/AuthorizesRequests.html