public function logout() { if ($this->isAuthenticated()) { $this->auth->logout(); $this->user = null; } }