class Authorize (View source)

Properties

protected Gate $gate

The gate instance.

Methods

void
__construct(Gate $gate)

Create a new middleware instance.

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

Handle an incoming request.

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

Get the arguments parameter for the gate.

Model|string
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

void __construct(Gate $gate)

Create a new middleware instance.

Parameters

Gate $gate

Return Value

void

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

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

Get the arguments parameter for the gate.

Parameters

Request $request
array|null $models

Return Value

Model|array|string

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

Get the model to authorize.

Parameters

Request $request
string $model

Return Value

Model|string

protected bool isClassName(string $value)

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

Parameters

string $value

Return Value

bool

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.