trait Illuminate / Http / ResponseTrait
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

ResponseTrait

Properties

public

$original mixed

The original content of the response.

Default: null
public

$exception Throwable |null

The exception that triggered the error response (if applicable).

Default: null

Methods

public

status ( ) : int

Get the status code for the response.

public

statusText ( ) : string

Get the status text for the response.

public

content ( ) : string

Get the content of the response.

public

getOriginalContent ( ) : mixed

Get the original response content.

public

Set a header on the Response.

Parameters

  • $key string
  • $values array|string
  • $replace bool
public

withHeaders ( $headers ) : $this

Add an array of headers to the response.

Parameters

  • $headers Symfony\...\HeaderBag|array
public

Add a cookie to the response.

Parameters

  • $cookie Symfony\...\Cookie|mixed
public

withCookie ( $cookie ) : $this

Add a cookie to the response.

Parameters

  • $cookie Symfony\...\Cookie|mixed
public

withoutCookie ( $cookie , $path , $domain ) : $this

Expire a cookie when sending the response.

Parameters

  • $cookie Symfony\...\Cookie|mixed
  • $path string|null
  • $domain string|null
public

getCallback ( ) : string|null

Get the callback of the response.

public

withException ( Throwable $e ) : $this

Set the exception to attach to the response.

Parameters

public

throwResponse ( ) : void

Throws the response in a HttpResponseException instance.