class AuthorizationException extends Exception

Properties

protected Response|null $response

The response from the gate.

protected int|null $status

The HTTP response status code.

Methods

__construct(string|null $message = null, int|string|null $code = null, Throwable|null $previous = null)

Create a new authorization exception instance.

Response|null
response()

Get the response from the gate.

setResponse(Response|null $response)

Set the response from the gate.

withStatus(int|null $status)

Set the HTTP response status code.

asNotFound()

Set the HTTP response status code to 404.

bool
hasStatus()

Determine if the HTTP status code has been set.

int|null
status()

Get the HTTP status code.

toResponse()

Create a deny response object from this exception.

Details

at line 25
__construct(string|null $message = null, int|string|null $code = null, Throwable|null $previous = null)

Create a new authorization exception instance.

Parameters

string|null $message
int|string|null $code
Throwable|null $previous

at line 35
Response|null response()

Get the response from the gate.

Return Value

Response|null

at line 43
AuthorizationException setResponse(Response|null $response)

Set the response from the gate.

Parameters

Response|null $response

Return Value

AuthorizationException

at line 53
AuthorizationException withStatus(int|null $status)

Set the HTTP response status code.

Parameters

int|null $status

Return Value

AuthorizationException

at line 63
AuthorizationException asNotFound()

Set the HTTP response status code to 404.

Return Value

AuthorizationException

at line 71
bool hasStatus()

Determine if the HTTP status code has been set.

Return Value

bool

at line 79
int|null status()

Get the HTTP status code.

Return Value

int|null

at line 87
Response toResponse()

Create a deny response object from this exception.

Return Value

Response