class Authenticate implements AuthenticatesRequests (View source)

Properties

protected Factory $auth

The authentication factory instance.

static protected callable $redirectToCallback

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

Methods

void
__construct(Factory $auth)

Create a new middleware instance.

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

Specify the guards for the middleware.

mixed
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.

Details

void __construct(Factory $auth)

Create a new middleware instance.

Parameters

Factory $auth

Return Value

void

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

Specify the guards for the middleware.

Parameters

string $guard
string ...$others

Return Value

string

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

Handle an incoming request.

Parameters

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

Return Value

mixed

Exceptions

AuthenticationException

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

protected never unauthenticated(Request $request, array $guards)

Handle an unauthenticated user.

Parameters

Request $request
array $guards

Return Value

never

Exceptions

AuthenticationException

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

static void redirectUsing(callable $redirectToCallback)

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

Parameters

callable $redirectToCallback

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.