Closed
Description
Currently route filters can be applied in two places:
- in app/Config/Filters.php using
$globals
,$methods
, or with URI patterns in$filters
- in app/Config/Routes.php as an option to any given route or route group, e.g.
['filter' => 'role:admin']
I would like to be able to use the versatility of URI patterns with filter parameters, but currently these are mutually-exclusive features. Entries in Filters.php cannot take parameters and Routes.php doesn't support filter options for non-specified routes. Using route groups we can apply a filter to any specified routes, e.g.:
$routes->group('manage', ['filter' => 'role:admin'], function($routes)
{
$routes->add('users', 'App\Controllers\Manage\Users::index');
});
... but this requires that all routes be listed explicitly rather than allowing auto-routing.
I would like to see either (or both):
- parameter support added to Filters.php
- some way of creating a route group (with options) that will apply the options to autorouted matches in Routes.php
Activity