class RedirectResponse extends RedirectResponse

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
protected Request|null $request

The request instance.

protected Store|null $session

The session store instance.

Methods

mixed
forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

static never
throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

int
status()

Get the status code for the response.

string
statusText()

Get the status text for the response.

string
content()

Get the content of the response.

mixed
getOriginalContent()

Get the original response content.

header(string $key, array|string $values, bool $replace = true)

Set a header on the Response.

withHeaders(HeaderBag|array $headers)

Add an array of headers to the response.

withoutHeader(array|string $key)

Remove a header(s) from the response.

cookie(mixed $cookie)

Add a cookie to the response.

withCookie(mixed $cookie)

Add a cookie to the response.

withoutCookie(mixed $cookie, string|null $path = null, string|null $domain = null)

Expire a cookie when sending the response.

string|null
getCallback()

Get the callback of the response.

withException(Throwable $e)

Set the exception to attach to the response.

never
throwResponse()

Throw the response in a HttpResponseException instance.

static void
macro(string $name, callable|object $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically bind flash data in the session.

with(string|array $key, mixed $value = null)

Flash a piece of data to the session.

withCookies(array $cookies)

Add multiple cookies to the response.

withInput(array|null $input = null)

Flash an array of input to the session.

array
removeFilesFromInput(array $input)

Remove all uploaded files from the given input array.

onlyInput()

Flash only the specified input keys to the session.

exceptInput()

Flash all input except the specified keys to the session.

withErrors(MessageProvider|array|string $provider, string $key = 'default')

Flash a container of errors to the session.

parseErrors(MessageProvider|array|string $provider)

Parse the given errors into an appropriate value.

withFragment(string $fragment)

Add a fragment identifier to the URL.

withoutFragment()

Remove any fragment identifier from the response URL.

enforceSameOrigin(string $fallback, bool $validateScheme = true, bool $validatePort = true)

Enforce that the redirect target must have the same host as the current request.

Request|null
getRequest()

Get the request instance.

setRequest(Request $request)

Set the request instance.

Store|null
getSession()

Get the session store instance.

setSession(Store $session)

Set the session store instance.

static void
flushState()

Flush all static state.

Details

in ForwardsCalls at line 22
protected mixed forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 52
protected mixed forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 66
static protected never throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

Parameters

string $method

Return Value

never

Exceptions

BadMethodCallException

in ResponseTrait at line 26
int status()

Get the status code for the response.

Return Value

int

in ResponseTrait at line 34
string statusText()

Get the status text for the response.

Return Value

string

in ResponseTrait at line 42
string content()

Get the content of the response.

Return Value

string

at line 181
mixed getOriginalContent()

Get the original response content.

Return Value

mixed

in ResponseTrait at line 62
ResponseTrait header(string $key, array|string $values, bool $replace = true)

Set a header on the Response.

Parameters

string $key
array|string $values
bool $replace

Return Value

ResponseTrait

in ResponseTrait at line 74
ResponseTrait withHeaders(HeaderBag|array $headers)

Add an array of headers to the response.

Parameters

HeaderBag|array $headers

Return Value

ResponseTrait

in ResponseTrait at line 92
ResponseTrait withoutHeader(array|string $key)

Remove a header(s) from the response.

Parameters

array|string $key

Return Value

ResponseTrait

Add a cookie to the response.

Parameters

mixed $cookie

Return Value

ResponseTrait

in ResponseTrait at line 116
ResponseTrait withCookie(mixed $cookie)

Add a cookie to the response.

Parameters

mixed $cookie

Return Value

ResponseTrait

in ResponseTrait at line 132
ResponseTrait withoutCookie(mixed $cookie, string|null $path = null, string|null $domain = null)

Expire a cookie when sending the response.

Parameters

mixed $cookie
string|null $path
string|null $domain

Return Value

ResponseTrait

in ResponseTrait at line 146
string|null getCallback()

Get the callback of the response.

Return Value

string|null

in ResponseTrait at line 156
ResponseTrait withException(Throwable $e)

Set the exception to attach to the response.

Parameters

Throwable $e

Return Value

ResponseTrait

in ResponseTrait at line 168
never throwResponse()

Throw the response in a HttpResponseException instance.

Return Value

never

Exceptions

HttpResponseException

in Macroable at line 28
static void macro(string $name, callable|object $macro)

Register a custom macro.

Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.

Parameters

string $name
callable|object $macro

Return Value

void

in Macroable at line 41
static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 57
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 68
static void flushMacros()

Flush the existing macros.

Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.

Return Value

void

in Macroable at line 78
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

at line 235
mixed __call(string $method, array $parameters)

Dynamically bind flash data in the session.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

at line 39
RedirectResponse with(string|array $key, mixed $value = null)

Flash a piece of data to the session.

Parameters

string|array $key
mixed $value

Return Value

RedirectResponse

at line 53
RedirectResponse withCookies(array $cookies)

Add multiple cookies to the response.

Parameters

array $cookies

Return Value

RedirectResponse

at line 65
RedirectResponse withInput(array|null $input = null)

Flash an array of input to the session.

Parameters

array|null $input

Return Value

RedirectResponse

at line 77
protected array removeFilesFromInput(array $input)

Remove all uploaded files from the given input array.

Parameters

array $input

Return Value

array

at line 95
RedirectResponse onlyInput()

Flash only the specified input keys to the session.

Return Value

RedirectResponse

at line 103
RedirectResponse exceptInput()

Flash all input except the specified keys to the session.

Return Value

RedirectResponse

at line 111
RedirectResponse withErrors(MessageProvider|array|string $provider, string $key = 'default')

Flash a container of errors to the session.

Parameters

MessageProvider|array|string $provider
string $key

Return Value

RedirectResponse

at line 132
protected MessageBag parseErrors(MessageProvider|array|string $provider)

Parse the given errors into an appropriate value.

Parameters

MessageProvider|array|string $provider

Return Value

MessageBag

at line 144
RedirectResponse withFragment(string $fragment)

Add a fragment identifier to the URL.

Parameters

string $fragment

Return Value

RedirectResponse

at line 153
RedirectResponse withoutFragment()

Remove any fragment identifier from the response URL.

Return Value

RedirectResponse

at line 161
RedirectResponse enforceSameOrigin(string $fallback, bool $validateScheme = true, bool $validatePort = true)

Enforce that the redirect target must have the same host as the current request.

Parameters

string $fallback
bool $validateScheme
bool $validatePort

Return Value

RedirectResponse

at line 189
Request|null getRequest()

Get the request instance.

Return Value

Request|null

at line 197
RedirectResponse setRequest(Request $request)

Set the request instance.

Parameters

Request $request

Return Value

RedirectResponse

at line 207
Store|null getSession()

Get the session store instance.

Return Value

Store|null

at line 215
RedirectResponse setSession(Store $session)

Set the session store instance.

Parameters

Store $session

Return Value

RedirectResponse

at line 225
static void flushState()

Flush all static state.

Return Value

void