Welcome Guest, Not a member yet? Register   Sign In
Multiple filters in route codeigniter 4

Hi everyone, I applied multiple filters in my codeigniter 4 route, more precisely I applied 2 filters for one route. an example like this:

$routes->get('beranda/administrator', 'Administrator::beranda', ['filter' => 'auth', 'filter' => 'admin']);

The filter works as I want, but only 1 filter works, namely the last filter: ['filter' => 'admin'] and for ['filter' => 'auth'] it doesn't work. I've also changed my code to:

$routes->get('beranda/administrator', 'Administrator::beranda', ['filter' => 'auth'] ,['filter' => 'admin']);

It's the same only one filter works. I want to ask how to apply 2 filters at once on 1 route and I just use the before function on each of those filters. ?

See https://codeigniter4.github.io/CodeIgnit...ml#aliases

(03-23-2021, 07:52 PM)kenjis Wrote: See https://codeigniter4.github.io/CodeIgnit...ml#aliases

Thank you for the response, my case has been solved. I use 1 filter for different authorities, that way I no longer need to use 1 filter for 1 authority.

Theme © iAndrew 2016 - Forum software by © MyBB