class PreventRequestsDuringMaintenance (View source)

Traits

Properties

protected Application $app

The application implementation.

protected array<int, string> $except

The URIs that should be excluded.

static protected array $neverPrevent

The URIs that should be accessible during maintenance.

Methods

bool
inExceptArray(Request $request)

Determine if the request has a URI that should be excluded.

array
getExcludedPaths()

Get the URIs that should be excluded.

void
__construct(Application $app)

Create a new middleware instance.

mixed
handle(Request $request, Closure $next)

Handle an incoming request.

bool
hasValidBypassCookie(Request $request, array $data)

Determine if the incoming request has a maintenance mode bypass cookie.

bypassResponse(string $secret)

Redirect the user back to the root of the application with a maintenance mode bypass cookie.

array
getHeaders(array $data)

Get the headers that should be sent with the response.

static void
except(array|string $uris)

Indicate that the given URIs should always be accessible.

static void
flushState()

Flush the state of the middleware.

Details

protected bool inExceptArray(Request $request)

Determine if the request has a URI that should be excluded.

Parameters

Request $request

Return Value

bool

array getExcludedPaths()

Get the URIs that should be excluded.

Return Value

array

void __construct(Application $app)

Create a new middleware instance.

Parameters

Application $app

Return Value

void

mixed handle(Request $request, Closure $next)

Handle an incoming request.

Parameters

Request $request
Closure $next

Return Value

mixed

Exceptions

HttpException
ErrorException

protected bool hasValidBypassCookie(Request $request, array $data)

Determine if the incoming request has a maintenance mode bypass cookie.

Parameters

Request $request
array $data

Return Value

bool

protected RedirectResponse bypassResponse(string $secret)

Redirect the user back to the root of the application with a maintenance mode bypass cookie.

Parameters

string $secret

Return Value

RedirectResponse

protected array getHeaders(array $data)

Get the headers that should be sent with the response.

Parameters

array $data

Return Value

array

static void except(array|string $uris)

Indicate that the given URIs should always be accessible.

Parameters

array|string $uris

Return Value

void

static void flushState()

Flush the state of the middleware.

Return Value

void

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.