Response
class Response extends Response (View source)
Traits
Properties
mixed | $original | The original content of the response. |
from ResponseTrait |
Throwable|null | $exception | The exception that triggered the error response (if applicable). |
from ResponseTrait |
static protected array | $macros | The registered string macros. |
from Macroable |
Methods
$this
header(string $key, array|string $values, bool $replace = true)
Set a header on the Response.
from
ResponseTrait
$this
withHeaders(HeaderBag|array $headers)
Add an array of headers to the response.
from
ResponseTrait
$this
withoutCookie(Cookie|mixed $cookie, string|null $path = null, string|null $domain = null)
Expire a cookie when sending the response.
from
ResponseTrait
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
from
Macroable
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
from
Macroable
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
from
Macroable
void
__construct(mixed $content = '', int $status = 200, array $headers = [])
Create a new HTTP response.
string|false
getContent()
Get the response content.
setContent(mixed $content)
Set the content on the response.
bool
shouldBeJson(mixed $content)
Determine if the given content should be turned into JSON.
string|false
morphToJson(mixed $content)
Morph the given content into JSON.
Details
$this
withoutCookie(Cookie|mixed $cookie, string|null $path = null, string|null $domain = null)
Expire a cookie when sending the response.
void
__construct(mixed $content = '', int $status = 200, array $headers = [])
Create a new HTTP response.