In CakePHP 2.0, I can check if there a flash message by using
if($session->check('Message.flash')){...}
I understand that in CakePHP 3.0, I read the doc that I can check if there a flash message by using
Layout
echo $this->Flash->render('auth');
Template/Users/login
echo $this->Flash->render();
if($this->request->is('flash')){...}else{...}
But in my view is when I added the above condition is not showing anything. My controller code is below
$this->Flash->error('The email address and/or password you specified are not correct.');
return $this->redirect(array('controller'=>'users', 'action' => 'login'));
Can anyone point to me what else is missing? I want to check if a flash message is shown in CakePHP 3.0. Thanks.
You can still do it in CakePHP 2 way that is read this value from session. You can access session in layout through request object.
Or if you want to check is there "auth" key message:
This is how session array now looks with Flash, if you wanna do something else: