Example #1
0
File: User.php Project: romeoz/rock
 /**
  * Logout user.
  * @param bool $destroy destroy session.
  */
 public function logout($destroy = true)
 {
     if (!$this->enableSession) {
         return;
     }
     $ip = $this->request->getUserIP();
     $id = $this->get('id');
     Log::info(BaseException::convertExceptionToString(new BaseException("User '{$id}' logged out from {$ip}.")));
     if ($destroy === true && $this->storage instanceof Session) {
         $this->storage->destroy();
         return;
     }
     $this->removeAll();
 }