I am struggling to work out the desired routes to enable me to use params in all cases where there is a prefix used in my routes. I will work perfectly without the admin prefit but not with routes desired:
/
/action
/action/{id}
/controller/action/
/controller/action/{id]
/admin/
/admin/action
/admin/action/{id}
/admin/controller/action/
/admin/controller/action/{id]
the code below will not allow for:
/admin/action/{id}
the error is Scorch\Controllers\Admin\EditController handler class cannot be loaded
<?php
$router = $di->getRouter();
$router->removeExtraSlashes(true);
$router->add('/', [
'namespace' => 'Scorch\Controllers',
'controller' => 'index'
]);
$router->add('/:controller/:action/:params', [
'namespace' => 'Scorch\Controllers',
'controller' => 1,
'action' => 2,
'params' => 3,
]);
$router->add('/:controller', [
'namespace' => 'Scorch\Controllers',
'controller' => 1
]);
$router->add('/admin', [
'namespace' => 'Scorch\Controllers\Admin',
'controller' => 'index'
]);
$router->add('/admin/:controller/:action/:params', [
'namespace' => 'Scorch\Controllers\Admin',
'controller' => 1,
'action' => 2,
'params' => 3,
]);
$router->add('/admin/:controller', [
'namespace' => 'Scorch\Controllers\Admin',
'controller' => 1
]);
$router->handle();
any ideas would be gratefully recieved