awaitingEmailConfirmation()) { return $this->emailConfirmationErrorResponse($request); } if (!hasAppAccess()) { if ($request->ajax()) { return response('Unauthorized.', 401); } else { return redirect()->guest(url('/login')); } } return $next($request); } }