Routes and Placeholders |
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!
There is no controller/method in the filter read this.
PHP Code: // No controller in the filter. CodeIgniter 4 User Guide - Configuring Filters What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
No, I also set Config/Filters.php
PHP Code: public $aliases = [
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. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
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) {
CodeIgniter is probably checking the first character to see if its a dollar sign for matching parameters.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |