/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (Auth::check()) { if (Auth::user()) { if ($request->ajax()) { return response('Unathorized.', 401); } else { $token = Input::get("token"); $user = Staff::get()->where('_token', '=', 'token'); return view('principal/profilePage', compact('user')); } } } return $next($request); }