Я работаю над проектом CakePhp 3, и я хочу использовать еще один макет по умолчанию для администратора. public function login()
{
if ($this->request->is('post')) {
$user = $this->Auth->identify();
if ($user) {
$this->Auth->setUser($user);
if($user('role')=== 'admin')
return $this->redirect(['controller' => 'admin', 'action' => 'dashboard']);
return $this->redirect($this->Auth->redirectUrl());
}
$this->Flash->error(__('Invalid username or password, try again'));
return $this->redirect(['action' => 'home', 'controller' => 'pages']);
}
}
Но как указать, что администратор контроллера будет использовать другой макет по умолчанию не только указать в действии с помощью:
//admin controller
public action dashboard(){
$this->layout='default2';
//...
}
Подробнее здесь: https://stackoverflow.com/questions/366 ... ult-layout