Response
class Response implements Arrayable (View source)
Properties
protected bool | $allowed | Indicates whether the response was allowed. | |
protected string|null | $message | The response message. | |
protected mixed | $code | The response code. |
Methods
void | __construct(bool $allowed, string $message = '', mixed $code = null) Create a new response. | |
static Response | allow(string|null $message = null, mixed $code = null) Create a new "allow" Response. | |
static Response | deny(string|null $message = null, mixed $code = null) Create a new "deny" Response. | |
bool | allowed() Determine if the response was allowed. | |
bool | denied() Determine if the response was denied. | |
string|null | message() Get the response message. | |
mixed | code() Get the response code / reason. | |
Response | authorize() Throw authorization exception if response was denied. | |
array | toArray() Convert the response to an array. | |
string | __toString() Get the string representation of the message. |
Details
void __construct(bool $allowed, string $message = '', mixed $code = null)
Create a new response.
static Response allow(string|null $message = null, mixed $code = null)
Create a new "allow" Response.
static Response deny(string|null $message = null, mixed $code = null)
Create a new "deny" Response.
bool allowed()
Determine if the response was allowed.
bool denied()
Determine if the response was denied.
string|null message()
Get the response message.
mixed code()
Get the response code / reason.
Response authorize()
Throw authorization exception if response was denied.
array toArray()
Convert the response to an array.
string __toString()
Get the string representation of the message.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/7.x/Illuminate/Auth/Access/Response.html