class Middleware

Properties

protected string $rootView

The root template that's loaded on the first page visit.

protected bool $withAllErrors

Determines if validation errors should be mapped to a single error message per field.

protected array<int, string> $withoutSsr

The paths that should be excluded from server-side rendering.

Methods

string|null
version(Request $request)

Determine the current asset version.

array
share(Request $request)

Define the props that are shared by default.

array
shareOnce(Request $request)

Define the props that are shared once and remembered across navigations.

string
rootView(Request $request)

Set the root template that is loaded on the first page visit.

Closure|null
urlResolver()

Define a callback that returns the relative URL.

Response
handle(Request $request, Closure $next)

Handle the incoming request.

void
storeCurrentUrl(Request $request, Response $response)

Store the current URL and route as the previous location, which Hypervel's session middleware skips for Inertia visits.

bool
shouldStoreCurrentUrl(Request $request, Response $response)

Determine if the visit should be stored as the previous location. Partial reloads are excluded, since deferred props, polling, and infinite scroll requests aren't navigations the user came from.

bool
isPartialReload(Request $request, Response $response)

Determine if the request is a partial reload of the component that was rendered.

void
addInertiaVaryHeader(Response $response)

Add the Inertia header to the response's Vary list.

bool
redirectHasFragment(Response $response)

Determine if the redirect response contains a URL fragment.

void
reflash(Request $request)

Reflash the session data for the next request.

Response
onEmptyResponse(Request $request, Response $response)

Handle empty responses.

Response
onRedirectWithFragment(Request $request, Response $response)

Handle redirects with URL fragments.

Response
onVersionChange(Request $request, Response $response)

Handle version changes.

object
resolveValidationErrors(Request $request)

Resolve validation errors for client-side use.

static void
flushState()

Flush all static state.

Details

at line 58
string|null version(Request $request)

Determine the current asset version.

The result is cached for the worker lifetime to avoid repeated filesystem I/O on every request.

Parameters

Request $request

Return Value

string|null

at line 93
array share(Request $request)

Define the props that are shared by default.

Parameters

Request $request

Return Value

array

at line 105
array shareOnce(Request $request)

Define the props that are shared once and remembered across navigations.

Parameters

Request $request

Return Value

array

at line 113
string rootView(Request $request)

Set the root template that is loaded on the first page visit.

Parameters

Request $request

Return Value

string

at line 121
Closure|null urlResolver()

Define a callback that returns the relative URL.

Return Value

Closure|null

at line 129
Response handle(Request $request, Closure $next)

Handle the incoming request.

Parameters

Request $request
Closure $next

Return Value

Response

at line 211
protected void storeCurrentUrl(Request $request, Response $response)

Store the current URL and route as the previous location, which Hypervel's session middleware skips for Inertia visits.

Parameters

Request $request
Response $response

Return Value

void

at line 228
bool shouldStoreCurrentUrl(Request $request, Response $response)

Determine if the visit should be stored as the previous location. Partial reloads are excluded, since deferred props, polling, and infinite scroll requests aren't navigations the user came from.

Parameters

Request $request
Response $response

Return Value

bool

at line 246
protected bool isPartialReload(Request $request, Response $response)

Determine if the request is a partial reload of the component that was rendered.

Parameters

Request $request
Response $response

Return Value

bool

at line 259
protected void addInertiaVaryHeader(Response $response)

Add the Inertia header to the response's Vary list.

Parameters

Response $response

Return Value

void

at line 271
protected bool redirectHasFragment(Response $response)

Determine if the redirect response contains a URL fragment.

Parameters

Response $response

Return Value

bool

at line 279
protected void reflash(Request $request)

Reflash the session data for the next request.

Parameters

Request $request

Return Value

void

at line 289
Response onEmptyResponse(Request $request, Response $response)

Handle empty responses.

Parameters

Request $request
Response $response

Return Value

Response

at line 297
Response onRedirectWithFragment(Request $request, Response $response)

Handle redirects with URL fragments.

Parameters

Request $request
Response $response

Return Value

Response

at line 307
Response onVersionChange(Request $request, Response $response)

Handle version changes.

Parameters

Request $request
Response $response

Return Value

Response

at line 324
object resolveValidationErrors(Request $request)

Resolve validation errors for client-side use.

Parameters

Request $request

Return Value

object

at line 355
static void flushState()

Flush all static state.

Return Value

void