CodeIgniter Forums
Can I have global filters segmented? - 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: Can I have global filters segmented? (/showthread.php?tid=81244)



Can I have global filters segmented? - castle - 02-09-2022

Hi,
My app is divided in Backend and Frontend. Is there a way to use global filters (App\Config\Filters) only for Backend's requests? 
Thanks.


RE: Can I have global filters segmented? - kilishan - 02-09-2022

Use the $filters config instead of $global.

PHP Code:
public filters = [
    
'foo' => ['before' => ['admin/*'], 'after' => ['users/*']],
    
'bar' => ['before' => ['api/*''admin/*']],
];