class AuthenticationRedirects

Single source of truth for boot-time auth redirect wiring.

Configures the worker-lifetime redirect callbacks on the auth/guest middleware and the authentication exception; it does not resolve or issue redirects at runtime.

Methods

static void
redirectGuestsTo(callable|string|null $redirect)

Configure where guests are redirected by the "auth" middleware.

static void
redirectUsersTo(callable|string $redirect)

Configure where users are redirected by the "guest" middleware.

static void
redirectTo(callable|string|null $guests = null, callable|string|null $users = null)

Configure where users are redirected by the authentication and guest middleware.

Details

at line 28
static void redirectGuestsTo(callable|string|null $redirect)

Configure where guests are redirected by the "auth" middleware.

The callback persists in authentication middleware and exception static properties for the worker lifetime and affects every subsequent unauthenticated or session-mismatch request.

Parameters

callable|string|null $redirect

Return Value

void

at line 45
static void redirectUsersTo(callable|string $redirect)

Configure where users are redirected by the "guest" middleware.

The callback persists in the guest middleware static property for the worker lifetime and affects every subsequent already-authenticated guest-route request.

Parameters

callable|string $redirect

Return Value

void

at line 58
static void redirectTo(callable|string|null $guests = null, callable|string|null $users = null)

Configure where users are redirected by the authentication and guest middleware.

The callbacks persist in authentication middleware and exception static properties for the worker lifetime and affect every subsequent matching request.

Parameters

callable|string|null $guests
callable|string|null $users

Return Value

void