Welcome Guest, Not a member yet? Register   Sign In
Apply filter for all functions inside a controller
#2

(This post was last modified: 08-19-2020, 12:09 PM by mlurie.)

(08-17-2020, 04:25 AM)eleumas Wrote: Hi! I created a filter for auth but i would like apply this filter for all methods inside the controller.

This is my routes:
PHP Code:
$routes->get('articles''Articles',['filter' => 'auth']);
$routes->get('articles/(:any)''Articles',['filter' => 'auth']); 

Is possible do it with a unique route? Someone can help me please? Thanks.

Check Grouping Routes in the CodeIgniter 4 documentation here: https://codeigniter.com/user_guide/incom...ing-routes.  Apply your filter to the group.
Reply


Messages In This Thread
RE: Apply filter for all functions inside a controller - by mlurie - 08-19-2020, 12:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB