php - CakePHP -Call to a member function allow() on null
one text
When I enter the user registration information and click the Register button then I have an error on this line in this function.
$this->Auth->allow(['register', 'login', 'logout', 'verification']);
Userscontroller.php
class UsersController extends AppController
{
public function beforeFilter(EventInterface $event)
{
parent::beforeFilter($event);
// Allow users to register and logout.
// You should not add the "login" action to allow list. Doing so would
// cause problems with normal functioning of AuthComponent.
$this->Auth->allow(['register', 'login', 'logout', 'verification']);
$this->viewBuilder()->setLayout('products');
}
// ...
}
Source