Skip to content

Request: Bulk route filters with parameters #2078

Closed
@MGatner

Description

@MGatner

Currently route filters can be applied in two places:

  1. in app/Config/Filters.php using $globals, $methods, or with URI patterns in $filters
  2. 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):

  1. parameter support added to Filters.php
  2. some way of creating a route group (with options) that will apply the options to autorouted matches in Routes.php

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions