Welcome Guest, Not a member yet? Register   Sign In
Problem with routes if Controller is in a subfolder
#1

(This post was last modified: 06-29-2020, 01:03 AM by kilden.)

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 !
Reply


Messages In This Thread
Problem with routes if Controller is in a subfolder - by kilden - 06-28-2020, 09:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB