controller(true); $action = $request->action(true); $path = $controller . '/' . $action; $user = null; if ($uid = Session::get('uid')) { if (!$user = Users::get($uid)) { Session::delete('uid'); } } if (!in_array($path, $this->paths) && !$user) { return redirect(url('/auth/login')); } $request->user = $user; // 单用户模式下, 只允许访问首页(除了接口) if (env('system.single_user_mode') && !$user) { if ($path !== 'index/index') { return redirect(url('/')); } } return $next($request); } }