Best way to get which route was called (for Filter classes) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Best way to get which route was called (for Filter classes) (/showthread.php?tid=74862) |
Best way to get which route was called (for Filter classes) - AcidSlide - 11-16-2019 Hi there, Can somebody suggest what is the best way to know which route was called from a controller or filter class? Please don't say use uri_string() as this won't work for projects that uses baseURLs with a subpath. I want to check (from my before() function in my custom filter) which route (or controller) was being called by the request. Thanks in advance RE: Best way to get which route was called (for Filter classes) - MGatner - 11-17-2019 I used to do something like that in my assets module. See if this helps: https://github.com/tattersoftware/codeigniter4-assets/blob/131f1b8c04d894f1b0e351d7c2523b744c184db5/src/Assets.php#L121 |