class AuthorizationException extends Exception (View source)

Properties

protected Response $response

The response from the gate.

protected int|null $status

The HTTP response status code.

Methods

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

Create a new authorization exception instance.

response()

Get the response from the gate.

$this
setResponse(Response $response)

Set the response from the gate.

$this
withStatus(int|null $status)

Set the HTTP response status code.

$this
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

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

Create a new authorization exception instance.

Parameters

string|null $message
mixed $code
Throwable $previous

Return Value

void

Response response()

Get the response from the gate.

Return Value

Response

$this setResponse(Response $response)

Set the response from the gate.

Parameters

Response $response

Return Value

$this

$this withStatus(int|null $status)

Set the HTTP response status code.

Parameters

int|null $status

Return Value

$this

$this asNotFound()

Set the HTTP response status code to 404.

Return Value

$this

bool hasStatus()

Determine if the HTTP status code has been set.

Return Value

bool

int|null status()

Get the HTTP status code.

Return Value

int|null

Response toResponse()

Create a deny response object from this exception.

Return Value

Response