Welcome Guest, Not a member yet? Register   Sign In
Controller Filters - Input needed
#28

(This post was last modified: 07-12-2016, 02:13 AM by arma7x.)

(07-11-2016, 10:23 PM)albertleao Wrote: Good work!

One question though, and I'm not sure this directly relates to just my application of CI but I declare all my routes in my routes.php file and have 650~ routes in my application. About 600 of those routes require authentication and I'd be putting an AuthFilter in front of them. Would that mean that I would have to rewrite all 600 routes in the Filters.php file? And if a route changes, I would have to change it in both locations?
IMO, filter should tie to controller and method. As example:
Filters rule;
PHP Code:
['Auth::login' => ['before' => 'IsGuest''after' => 'RecordLogin']]; 

Now if we we change the route;
PHP Code:
$routes->add('auth/local''Auth::login'); 
to
PHP Code:
$routes->add('auth/basic''Auth::login'); 
,
we don't have to change the filter, since the rules is applied to controller and method, not route itself.
KeepĀ calm.
Reply


Messages In This Thread
Controller Filters - Input needed - by kilishan - 07-07-2016, 08:39 PM
RE: Controller Filters - Input needed - by arma7x - 07-10-2016, 06:46 AM
RE: Controller Filters - Input needed - by arma7x - 07-07-2016, 09:14 PM
RE: Controller Filters - Input needed - by arma7x - 07-10-2016, 11:42 PM
RE: Controller Filters - Input needed - by arma7x - 07-12-2016, 01:55 AM
RE: Controller Filters - Input needed - by arma7x - 07-13-2016, 12:23 AM
RE: Controller Filters - Input needed - by arma7x - 07-14-2016, 12:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB