![]() |
Routes and Placeholders - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Routes and Placeholders (/showthread.php?tid=79276) |
Routes and Placeholders - p.mancini - 05-21-2021 In Config\Routes.php I created this roule PHP Code: $routes->group(SEGMENTURL_ADMIN, ['filter' => 'admin_role:superadmin,admin'], function($routes) { If I add any char before the placeholder, example PHP Code: $routes->group(SEGMENTURL_ADMIN, ['filter' => 'admin_role:superadmin,admin'], function($routes) { No problem without a group routes, for example PHP Code: $routes->get('{locale}/(:segment)', '$1_frontend'); is there a bug or am I wrong something? Thanks! RE: Routes and Placeholders - InsiteFX - 05-21-2021 There is no controller/method in the filter read this. PHP Code: // No controller in the filter. CodeIgniter 4 User Guide - Configuring Filters RE: Routes and Placeholders - p.mancini - 05-21-2021 No, I also set Config/Filters.php PHP Code: public $aliases = [ RE: Routes and Placeholders - InsiteFX - 05-21-2021 Restricting Route Groups In the same way, entire groups of routes can be restricted within the PHP Code: $routes->group('admin', ['filter' => 'role:admin,superadmin'], function($routes) { I'm not sure were you are getting your values from but that's how Myth/Auth shows it. And the filters are these: PHP Code: 'login' => \Myth\Auth\Filters\LoginFilter::class, There has been a few updates to Myth/Auth maybe download it again. UPDATE: I just checked and Myth/Auth was updated again 7 hours ago. RE: Routes and Placeholders - p.mancini - 05-22-2021 Thanks a lot for the answers InsiteFX. The problem is not with the filters. In fact, the problem remains even if I remove filters and change the routing code to PHP Code: $routes->group(SEGMENTURL_ADMIN, function($routes) { Result: 404 error "Controller or its method is not found: \App\Controllers$1_admin::index". The placeholder appears to have problems if placed at the beginning. If I change the rule to PHP Code: $routes->group(SEGMENTURL_ADMIN, function($routes) { PHP Code: $routes->group(SEGMENTURL_ADMIN, function($routes) { RE: Routes and Placeholders - InsiteFX - 05-22-2021 CodeIgniter is probably checking the first character to see if its a dollar sign for matching parameters. |