• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Controller Filters - Input needed

#29
@arma7x - I get what you're saying about tieing to a controller/method, I do. I don't think it's the most practical method though. I keep hearing people talk about having hundreds or thousands of controllers. That would be a horror trying to map up filters to. And by attaching to the uri, you can easily wild-card entire groups of routes to cut down on the maintenance.

@albertleao - Not at all! That's where wild-carding comes in. If all of those pages are behind an 'admin' uri, then you can specify it like:

Code:
'adminAuth'  => ['before' => ['admin/*']]

in the $filters array. That would apply to any uri that starts with **admin**. Or if it's you have a small section of your site or two that is easily group-able you could do it as an exclusion to the global setting, like:

Code:
public $globals = [
        'before' => [
            'isLoggedIn' => ['except' => ['auth/*', 'pages/*'] ],
        ]
    ];

Does that make sense?
Support Development  • Practical CodeIgniter 3  •
Myth:AuthVulcan - CLI Tools for CI4
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 kilishan - 07-12-2016, 10:00 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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.