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