class Illuminate / Auth / Access / Response
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

Response

Implements

  • Illuminate\...\Arrayable
  • Stringable

Properties

protected

$allowed
  • bool
  • Indicates whether the response was allowed.

    Default: null
    protected

    $message
  • string
  • null
  • The response message.

    Default: null
    protected

    $code
  • mixed
  • The response code.

    Default: null
    protected

    $status
  • int
  • null
  • The HTTP response status code.

    Default: null

    Methods

    public

    __construct ( $allowed , $message , $code ) : void

    Create a new response.

    Parameters

    • $allowed bool
    • $message string
    • $code mixed
    public static

    allow ( $message , $code ) : Response

    Create a new "allow" Response.

    Parameters

    • $message string|null
    • $code mixed
    public static

    deny ( $message , $code ) : Response

    Create a new "deny" Response.

    Parameters

    • $message string|null
    • $code mixed
    public static

    denyWithStatus ( $status , $message , $code ) : Response

    Create a new "deny" Response with a HTTP status code.

    Parameters

    • $status int
    • $message string|null
    • $code mixed
    public static

    denyAsNotFound ( $message , $code ) : Response

    Create a new "deny" Response with a 404 HTTP status code.

    Parameters

    • $message string|null
    • $code mixed
    public

    allowed ( ) : bool

    Determine if the response was allowed.

    public

    denied ( ) : bool

    Determine if the response was denied.

    public

    message ( ) : string|null

    Get the response message.

    public

    code ( ) : mixed

    Get the response code / reason.

    public

    authorize ( ) : Response

    Throw authorization exception if response was denied.

    public

    withStatus ( $status ) : $this

    Set the HTTP response status code.

    Parameters

    • $status null|int
    public

    asNotFound ( ) : $this

    Set the HTTP response status code to 404.

    public

    status ( ) : int|null

    Get the HTTP status code.

    public

    toArray ( ) : array

    Convert the response to an array.

    public

    __toString ( ) : string

    Get the string representation of the message.