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

So, here's what I'm thinking for the config file. This would seem to cover all of the bases, and still be simple to use, right? I thought of mapping to controllers instead of URI's/routes, but this seemed to make more sense so the application could change the underlying controllers if needed and still be covered.

Code:
<?php namespace Config;

class Filters
{
    // Makes reading things below nicer,
    // and simpler to change out script that's used.
    public $aliases = [
        'isLoggedIn' => 'App\Filters\Authentication'
    ];

    // Always applied before every request
    public $global = [
        'isLoggedIn'               => ['except' => 'login'],
        'CodeIgniter\Filters\CSRF' => '*'
    ];

    public $routes = [
        'admin/*' => [
            'before' => ['isLoggedIn'],
            'after' => ['somethingElse']
        ]
    ];
}
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 kilishan - 07-10-2016, 09:55 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