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 26
__construct(Factory $auth)

Create a new middleware instance.

Parameters

Factory $auth

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

Specify the guards for the middleware.

Parameters

string $guard
string ...$others

Return Value

string

at line 44
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 56
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 78
protected never unauthenticated(Request $request, array $guards)

Handle an unauthenticated user.

Parameters

Request $request
array $guards

Return Value

never

Exceptions

AuthenticationException

at line 90
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 106
static void redirectUsing(callable $redirectToCallback)

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

Boot-only. 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 114
static void flushState()

Flush all static state.

Return Value

void