lucasctd
7 months ago
1136
8
Lumen

Optional parameters inside group

Posted 7 months ago by lucasctd

For some reason if you write a route inside a group only with a optional parameter, Lumen will return 404. For example:


$router->group(['prefix' => 'client'], function () use ($router) {
       $router->get('[/{id}]', ['as' => 'findClient', 'uses' => '[email protected]']);
});

However, if I write:

$router->get('/client[/{id}]', ['as' => 'findClient', 'uses' => '[email protected]']);

It works. It also works:

$router->group(['prefix' => 'client'], function () use ($router) {
       $router->get('blabla[/{id}]', ['as' => 'findClient', 'uses' => '[email protected]']);
});

I think it's a bug. Have any of you guys faced this problem?

Please sign in or create an account to participate in this conversation.