In the method on my controller I will flash the box, according to the condition.
if ($this->Auth->user()) {
//redireciona apos o login;
echo $this->Session->setFlash("Bem-vindo");
}
How can I display this directly from the view, instead of displaying it in the method? For example, the method would return true
in case of logging and on the page to which I redirected the user I would access the flash message or something.
I do not want to use echo
, as it is a short and temporary message or until the page is reloaded or refreshed.
I have tried to access $this->Session->setFlash()
, but it gives helper error. Maybe, would I creating a helper solve the problem then? $ this->Session->flash()
has no message. You would only access a component, in this case it could be Auth
, for example: $this->Session->flash('Auth');
Does anyone suggest anything?