class Authenticate implements AuthenticatesRequests

Properties

static protected null|callable $redirectToCallback

The callback that should be used to generate the authentication redirect path.

Methods

__construct(Factory $auth)

Create a new middleware instance.

static string
using(string $guard, string ...$others)

Specify the guards for the middleware.

Response
handle(Request $request, Closure $next, string ...$guards)

Handle an incoming request.

void
authenticate(Request $request, array $guards)

Determine if the user is logged in to any of the given guards.

never
unauthenticated(Request $request, array $guards)

Handle an unauthenticated user.

string|null
redirectTo(Request $request)

Get the path the user should be redirected to when they are not authenticated.

static void
redirectUsing(callable $redirectToCallback)

Specify the callback that should be used to generate the redirect path.

static void
flushState()

Flush all static state.

Details

at line 27
__construct(Factory $auth)

Create a new middleware instance.

Parameters

Factory $auth

at line 35
static string using(string $guard, string ...$others)

Specify the guards for the middleware.

Parameters

string $guard
string ...$others

Return Value

string

at line 45
Response handle(Request $request, Closure $next, string ...$guards)

Handle an incoming request.

Parameters

Request $request
Closure $next
string ...$guards

Return Value

Response

Exceptions

AuthenticationException

at line 57
protected void authenticate(Request $request, array $guards)

Determine if the user is logged in to any of the given guards.

Parameters

Request $request
array $guards

Return Value

void

Exceptions

AuthenticationException

at line 79
protected never unauthenticated(Request $request, array $guards)

Handle an unauthenticated user.

Parameters

Request $request
array $guards

Return Value

never

Exceptions

AuthenticationException

at line 91
protected string|null redirectTo(Request $request)

Get the path the user should be redirected to when they are not authenticated.

Parameters

Request $request

Return Value

string|null

at line 107
static void redirectUsing(callable $redirectToCallback)

Specify the callback that should be used to generate the redirect path.

The callback persists in a static property for the worker lifetime and runs on every unauthenticated request handled by this middleware.

Parameters

callable $redirectToCallback

Return Value

void

at line 116
static void flushState()

Flush all static state.

Return Value

void