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

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

Code:
$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:

Code:
$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. ?
Reply
#2

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

(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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB