CodeIgniter Forums
Move Routers to Controller? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Move Routers to Controller? (/showthread.php?tid=80482)



Move Routers to Controller? - motoroller - 11-07-2021

Hello, is it possible move routers rules ti contoller? ( in CI3)


RE: Move Routers to Controller? - includebeer - 11-07-2021

What do you have in mind? The router decide which controller to call. How can it work the other way around? The only thing I can think of is a base controller that would do redirects in its constructor.


RE: Move Routers to Controller? - motoroller - 11-07-2021

I mean put router code in Controller, beacause my routes.php is too big, and easy controll routers in controller


RE: Move Routers to Controller? - includebeer - 11-07-2021

(11-07-2021, 12:28 PM)motoroller Wrote: beacause my routes.php is too big

Why is it a problem? If you move that code in the controller it will be the same size. I don't get it.

(11-07-2021, 12:28 PM)motoroller Wrote: and easy controll routers in controller

...if it's easy, then do it?  Huh