public function isValid($data = null) { if (SessionFacade::has('auth')) { return true; } if (CookieFacade::has('auth')) { $user = Users::findByCookieAuth($this->getCookie()); if (!$user) { return false; } FlashFacade::success('欢迎' . $user->name . '登录!你上次登录的时间是:' . $user->updated_at); //利用cookie实现登录 EventFacade::fire('auth:login', $user, ['remember' => 'on']); return true; } return false; }