<?phpnamespaceApp\Http\Middleware;useIlluminate\Auth\Middleware\AuthenticateasMiddleware;useIlluminate\Http\Request;classAuthenticateextendsMiddleware{/** * Get the path the user should be redirected to when they are not authenticated. */protectedfunctionredirectTo(Request$request):?string{return$request->expectsJson()?null:route('login');}}