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. ?

Messages In This Thread
Multiple filters in route codeigniter 4 - by Rivaldy Saputra Agus - 03-22-2021, 08:06 PM

Theme © iAndrew 2016 - Forum software by © MyBB