From e2f0635a97262ebba30f5f6aaf4b37579fe969f9 Mon Sep 17 00:00:00 2001 From: MGatner Date: Tue, 2 Apr 2019 14:40:19 -0400 Subject: [PATCH 1/3] Add details about route filters --- user_guide_src/source/incoming/routing.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index 33b2645509da..aee8c0117b5a 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -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 `_ gets ran for a group of routes. This will always +You can also use ensure that a specific `filter `_ 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) @@ -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 `_ for more information on setting up filters. + Assigning Namespace ------------------- From a760be20f412e0e1e7bff8d922e02bacfc642f87 Mon Sep 17 00:00:00 2001 From: MGatner Date: Tue, 2 Apr 2019 14:41:20 -0400 Subject: [PATCH 2/3] Fix formatting --- user_guide_src/source/incoming/routing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index aee8c0117b5a..4a8f32d923bc 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -396,11 +396,11 @@ can modify the generated routes, or further restrict them. The ``$options`` arra 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:: +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: +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']); From 84587e7b2ef8d1976f1d7f41f7ef6e7764fd9164 Mon Sep 17 00:00:00 2001 From: MGatner Date: Tue, 2 Apr 2019 14:42:23 -0400 Subject: [PATCH 3/3] Supply missing quotes --- user_guide_src/source/incoming/routing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index 4a8f32d923bc..e68dd8fb5ae5 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -398,11 +398,11 @@ 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']); + $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']); + $routes->add('users/delete/(:segment)', 'AdminController::index', ['filter' => 'admin-auth:dual,noreturn']); See `Controller filters `_ for more information on setting up filters.