Welcome Guest, Not a member yet? Register   Sign In
Order of filter
#1

I have 2 filters one is global and another one in routers for few controllers

and i saw when i load controllers with extra filter
like
$routes->get('/', [StockShop::class, 'Index/List'], [ 'filter' => 'isBlocked' ]);

firstly execute isBlocked filter than global one, is it possible change order?
Rightly execute global first than others
Reply
#2

The filters are executed in the order defined in the config file. However, if enabled, DebugToolbar is always executed
last because it should be able to capture everything that happens in the other filters.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(01-04-2023, 12:06 AM)InsiteFX Wrote: The filters are executed in the order defined in the config file. However, if enabled, DebugToolbar is always executed
last because it should be able to capture everything that happens in the other filters.

In config only global,
in routers setting filter in route, how config order?
Reply
#4

(This post was last modified: 01-04-2023, 10:29 PM by kenjis.)

(01-03-2023, 11:30 PM)motoroller Wrote: firstly execute isBlocked filter than global one, is it possible change order?

No, unless you extend/replace the framework class.
Reply
#5

I sent a PR to change the order.
https://github.com/codeigniter4/CodeIgniter4/pull/7955
Reply




Theme © iAndrew 2016 - Forum software by © MyBB