class Authorize

Properties

protected Factory $auth

The authentication factory instance.

protected Gate $gate

The gate instance.

Methods

void
__construct(Factory $auth, Gate $gate)

Create a new middleware instance.

mixed
handle(Request $request, Closure $next, string $ability, array|null ...$models)

Handle an incoming request.

array|string|Model
getGateArguments(Request $request, array|null $models)

Get the arguments parameter for the gate.

string|Model
getModel(Request $request, string $model)

Get the model to authorize.

bool
isClassName(string $value)

Checks if the given string looks like a fully qualified class name.

Details

at line 33
void __construct(Factory $auth, Gate $gate)

Create a new middleware instance.

Parameters

Factory $auth
Gate $gate

Return Value

void

at line 51
mixed handle(Request $request, Closure $next, string $ability, array|null ...$models)

Handle an incoming request.

Parameters

Request $request
Closure $next
string $ability
array|null ...$models

Return Value

mixed

Exceptions

AuthenticationException
AuthorizationException

at line 67
protected array|string|Model getGateArguments(Request $request, array|null $models)

Get the arguments parameter for the gate.

Parameters

Request $request
array|null $models

Return Value

array|string|Model

at line 85
protected string|Model getModel(Request $request, string $model)

Get the model to authorize.

Parameters

Request $request
string $model

Return Value

string|Model

at line 96
protected bool isClassName(string $value)

Checks if the given string looks like a fully qualified class name.

Parameters

string $value

Return Value

bool