guest()) { if ($request->ajax()) { return response('Unauthorized.', 401); } return redirect()->guest('login'); } /** @var User $user */ $user = auth()->user(); if ($user->hasRole('demo')) { Session::flash('warning', strval(trans('firefly.not_available_demo_user'))); return redirect(route('index')); } if (intval(getenv('SANDSTORM')) === 1) { Session::flash('warning', strval(trans('firefly.sandstorm_not_available'))); return redirect(route('index')); } return $next($request); } }