My Logout function is working very well with only return $this->redirect($this->Auth->logout());.
But how could I make a logout function with a Flash message? I tried this function. It doesn't work. I'm always login and it doesn't show me message:(
public function logout() {
if ($this->Auth->user('logged_in')) {
$this->Session->setFlash(__('you are logout'), 'default', array('class' => 'alert alert-success'));
return $this->redirect($this->Auth->logout());
} else {
$this->Session->setFlash(__('you aren\'t logout, Please, try again'), 'default', array('class' => 'alert alert-danger'));
}
}