class EnsureFrontendRequestsAreStateful

Properties

static protected null|Request): bool $statefulRequestResolver

The closure used to determine whether the current request is stateful.

static protected null|Request): array<int, string> $statefulDomainsResolver

The closure used to resolve stateful domains for the current request.

Methods

Response
handle(Request $request, Closure $next)

Handle the incoming requests.

array
frontendMiddleware()

Get the middleware that should be applied to requests from the "frontend".

static bool
fromFrontend(Request $request)

Determine if the given request is from the first-party application frontend.

static void
resolveStatefulRequestsUsing(Closure|null $callback)

Register a closure that determines whether the current request is stateful.

static void
resolveStatefulDomainsUsing(Closure|null $callback)

Register a closure that resolves stateful domains for the current request.

static void
flushState()

Flush all static state.

Details

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

Handle the incoming requests.

Parameters

Request $request
Closure $next

Return Value

Response

at line 55
protected array frontendMiddleware()

Get the middleware that should be applied to requests from the "frontend".

Return Value

array

at line 93
static bool fromFrontend(Request $request)

Determine if the given request is from the first-party application frontend.

Parameters

Request $request

Return Value

bool

at line 155
static void resolveStatefulRequestsUsing(Closure|null $callback)

Register a closure that determines whether the current request is stateful.

Boot-only. The closure receives the current request and returns the final stateful decision. Persists for the worker lifetime.

Parameters

Closure|null $callback

Return Value

void

at line 169
static void resolveStatefulDomainsUsing(Closure|null $callback)

Register a closure that resolves stateful domains for the current request.

Boot-only. The closure receives the current request and returns the stateful domain list; useful when the list varies by host or other request data. Persists for the worker lifetime.

Parameters

Closure|null $callback

Return Value

void

at line 177
static void flushState()

Flush all static state.

Return Value

void