CodeIgniter Forums
Multiple Filters not working when added to a single alias - 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: Multiple Filters not working when added to a single alias (/showthread.php?tid=77162)



Multiple Filters not working when added to a single alias - mlurie - 07-27-2020

I have two filters that I would like to apply to a single route.  ValidUser checks to see if the user exists in the database.  CurrentUser checks to see if the the user is currently logged in.  I created both filters and corresponding aliases in App\Filters, and they work when applied to the routes in question individually.  I also created another alias containing both filters in App\Filters:

PHP Code:
'check_user' => [
    \
App\Filters\ValidUser::class,
    \
App\Filters\CurrentUser::class,


However, when 'check_user' is applied to a route, neither filter works.

PHP Code:
$routes->get('remove/(:num)''Admin\Users::delete/$1', ['filter' => 'check_user:users']); 

What am I doing wrong?


RE: Multiple Filters not working when added to a single alias - mlurie - 07-27-2020

I figured it out. My controller name was the same as one of my route paths, and that was messing things up with auto-routing enabled. I've change the route path and all is well.