Skip to content

Commit

Permalink
Merge pull request #1908 from MGatner/guide-filter-parameters
Browse files Browse the repository at this point in the history
Add filter parameters to User Guide
  • Loading branch information
lonnieezell authored Apr 2, 2019
2 parents e80811a + 84587e7 commit 2cda498
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion user_guide_src/source/incoming/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ If you need to assign options to a group, like a `namespace <#assigning-namespac

This would handle a resource route to the ``App\API\v1\Users`` controller with the ``/api/users`` URI.

You can also use ensure that a specific `filter </incoming/filters.html>`_ gets ran for a group of routes. This will always
You can also use ensure that a specific `filter </incoming/filters.html>`_ runs for a group of routes. This will always
run the filter before or after the controller. This is especially handy during authentication or api logging::

$routes->group('api', ['filter' => 'api-auth'], function($routes)
Expand Down Expand Up @@ -393,6 +393,19 @@ can modify the generated routes, or further restrict them. The ``$options`` arra
$routes->map($array, $options);
$routes->group('name', $options, function());

Applying Filters
----------------

You can alter the behavior of specific routes by supplying a filter to run before or after the controller. This is especially handy during authentication or api logging::

$routes->add('admin',' AdminController::index', ['filter' => 'admin-auth']);

The value for the filter must match one of the aliases defined within ``app/Config/Filters.php``. You may also supply parameters to be passed to the filter's ``before()`` and ``after()`` methods::

$routes->add('users/delete/(:segment)', 'AdminController::index', ['filter' => 'admin-auth:dual,noreturn']);

See `Controller filters </incoming/filters.html>`_ for more information on setting up filters.

Assigning Namespace
-------------------

Expand Down

0 comments on commit 2cda498

Please sign in to comment.