Response
class Response implements Responsable
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected string | $component | The name of the root component. |
|
| protected array<string, mixed> | $props | The page props. |
|
| protected string | $rootView | The name of the root view. |
|
| protected string | $version | The asset version. |
|
| protected bool | $clearHistory | Indicates if the browser history should be cleared. |
|
| protected bool | $preserveFragment | Indicates if the URL fragment should be preserved across redirects. |
|
| protected bool | $encryptHistory | Indicates if the browser history should be encrypted. |
|
| protected array<string, mixed> | $viewData | The view data. |
|
| protected Closure|null | $urlResolver | The URL resolver callback. |
|
| protected array<array-key, mixed|ProvidesInertiaProperties> | $sharedProps | The shared properties (before merge with page props). |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new Inertia response instance.
Add additional properties to the page.
Add additional data to the view.
Add flash data to the response.
Ensure the URL has a trailing slash before the query string.
Flush all static state.
Details
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.
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.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
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.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 88
__construct(string $component, array $sharedProps, array $props, string $rootView = 'app', string $version = '', bool $encryptHistory = false, Closure|null $urlResolver = null)
Create a new Inertia response instance.
at line 115
Response
with(array<string, mixed>|ProvidesInertiaProperties|string $key, mixed $value = null)
Add additional properties to the page.
at line 135
Response
withViewData(array<string, mixed>|string $key, mixed $value = null)
Add additional data to the view.
at line 151
Response
rootView(string $rootView)
Set the root view.
at line 164
Response
flash(BackedEnum|UnitEnum|string|array $key, mixed $value = null)
Add flash data to the response.
at line 174
Response
toResponse(Request $request)
Create an HTTP response that represents the object.
at line 207
protected array
resolveClearHistory(Request $request)
Resolve the clear history flag.
at line 217
protected array
resolveEncryptHistory(Request $request)
Resolve the encrypt history flag.
at line 227
protected array
resolveFlashData(Request $request)
Resolve flash data from the session.
at line 239
protected array
resolvePreserveFragment(Request $request)
Resolve the preserve fragment flag from the session.
at line 247
protected string
getUrl(Request $request)
Get the URL from the request while preserving the trailing slash.
at line 263
protected string
finishUrlWithTrailingSlash(string $url)
Ensure the URL has a trailing slash before the query string.
at line 276
static void
flushState()
Flush all static state.