Problem with routes if Controller is in a subfolder |
Hi I have the same issue. Before the subfolder name use a \ of this kind and not /$routes->match(['get','post' Wrote:, 'amp/vamos/(:any).html', 'Amp\Descuento_amp::hola/$1');kilden pid='377340' dateline='1593403441']Hello,
I don't know if it's a good practice, but I wanted to put the controllers for my admin in a subfolder called 'admin' to keep it tidy. So I've changed the namespace like this...
Code: namespace App\Controllers\admin;
... copied the base controller in my admin folder (that's probably the problem)
...And change my routes like this...
Code: $routes->post('/admin/mycontroller', 'admin/Mycontroller::mymethod');
Everything worked well till I wanted to pass arguments...
It works like this :
Code: $routes->match(['get','post'], '/admin/translations/(: segment)', 'Admin_translations::translate/$1');
It doesn't work like this :
Code: $routes->match(['get','post'], '/admin/translations/(: segment)', 'admin/Translations::translate/$1');
What should I do to fix this issue ?
Thank you for any help !
|
Messages In This Thread |
RE: Problem with routes if Controller is in a subfolder - by rjaramilloortiz - 09-14-2021, 09:01 AM
|