Documentation

AuthorizesRequests

Table of Contents

authorize()  : Response
Authorize a given action for the current user.
authorizeForUser()  : Response
Authorize a given action for a user.
authorizeResource()  : void
Authorize a resource action based on the incoming request.
normalizeGuessedAbilityName()  : string
Normalize the ability name that has been guessed from the method name.
parseAbilityAndArguments()  : array<string|int, mixed>
Guesses the ability's name if it wasn't provided.
resourceAbilityMap()  : array<string|int, mixed>
Get the map of resource methods to ability names.
resourceMethodsWithoutModels()  : array<string|int, mixed>
Get the list of resource methods which do not have model parameters.

Methods

authorize()

Authorize a given action for the current user.

public authorize(mixed $ability[, mixed|array<string|int, mixed> $arguments = [] ]) : Response
Parameters
$ability : mixed
$arguments : mixed|array<string|int, mixed> = []
Tags
throws
AuthorizationException
Return values
Response

authorizeResource()

Authorize a resource action based on the incoming request.

public authorizeResource(string $model[, string|null $parameter = null ][, array<string|int, mixed> $options = [] ][, Request|null $request = null ]) : void
Parameters
$model : string
$parameter : string|null = null
$options : array<string|int, mixed> = []
$request : Request|null = null
Return values
void

normalizeGuessedAbilityName()

Normalize the ability name that has been guessed from the method name.

protected normalizeGuessedAbilityName(string $ability) : string
Parameters
$ability : string
Return values
string

parseAbilityAndArguments()

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

protected parseAbilityAndArguments(mixed $ability, mixed|array<string|int, mixed> $arguments) : array<string|int, mixed>
Parameters
$ability : mixed
$arguments : mixed|array<string|int, mixed>
Return values
array<string|int, mixed>

resourceAbilityMap()

Get the map of resource methods to ability names.

protected resourceAbilityMap() : array<string|int, mixed>
Return values
array<string|int, mixed>

resourceMethodsWithoutModels()

Get the list of resource methods which do not have model parameters.

protected resourceMethodsWithoutModels() : array<string|int, mixed>
Return values
array<string|int, mixed>

Search results