I am facing issue in cakephp3. In routes.php I have used
Router::prefix('admin', function ($routes) {
$routes->connect('/', ['controller' => 'TblUsers', 'action' => 'index']);
});
I have placed the TblUsers inside Admin folder
In app controller code:
$this->loadComponent('Auth', [
'authenticate' => [
'Form' => [
'fields' => [
'username' => 'username',
//'password' => 'password'
],
'scope' => ['role' => '1']
]
],
'loginAction' => [
'controller' => 'Users',
'action' => 'login',
'admin'=>true,
'prefix'=>true
],
'redirectUrl' => [
'controller' => 'TblUsers',
'action' => 'index',
'admin'=>true,
],
'loginRedirect' => [
'controller' => 'TblUsers',
'action' => 'index',
'admin'=>true,
]
]);
Now when I access the users/login its giving me error:
Error: A route matching "array ( 'controller' => 'Users', 'action' => 'login', 'admin' => true, 'prefix' => true, 'plugin' => NULL, '_ext' => NULL, )" could not be found.
OR
Is there any way in cakephp3 like cakephp2 to access the functions inside any controller start with admin_functionname and call the admin_functionname.ctp file and also add the admin inside the url.
Thanks