Welcome Guest, Not a member yet? Register   Sign In
route group, only first one works
#1

(This post was last modified: 01-25-2023, 05:50 AM by sjender.)

I am trying to group my routes in order to improve the readability.
But if I add a group, only the first one in the group seems to work.

PHP Code:
$routes->group('cms', static function ($routes) {
    $routes->get('/', [Dashboard::class, 'index']);
    $routes->get('/login', [Authentication::class, 'login']);
});

//$routes->get('/cms/', [Dashboard::class, 'index']);
//$routes->get('/cms/login', [Authentication::class, 'login']); 

When I un-escape the original routes, all works well, but in the group only /cms works.
Am I expecting something other than designed?
https://site/cms/login ends up with:
Code:
404 - File Not Found
Can't find a route for 'get: cms/login'.
Reply
#2

remove / (backlash)
$routes->get('login', [Authentication::class, 'login']);
Reply
#3

(This post was last modified: 01-26-2023, 12:51 AM by sjender.)

Yes, that did the trick....
Thanks!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB