check()) { return $next($request); } $url = url()->full(); if (! $request->isMethod('get')) { $url = url()->previous(); } session()->put('url.intended', $url); if ($request->ajax()) { abort(403, 'Unauthenticated.'); } return redirect()->route('login'); } }