[Controller Filters] Controller Index problem |
Hello,
I created filters for some of my webpage, the pattern is like this PHP Code: public $filters = [ But the problem is when I visit index method of those controllers, the filter won't applied because we usually visit https://example.com/user instead of https://example.com/user/index. So my temporarily solution is something like this PHP Code: public $filters = [ Am I missing something here? Is there any other elegant solution?
The controller index method is the default method that is called when no controller
method is specified. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Depending on how your routes are setup, you can often use the wildcard without the slash to make it work:
PHP Code: public $filters = [ (06-19-2020, 10:37 AM)kilishan Wrote: Depending on how your routes are setup, you can often use the wildcard without the slash to make it work: Why I did not think of this. Thanks for your reply Kilishan |
Welcome Guest, Not a member yet? Register Sign In |