Skip to content

Commit

Permalink
Merge pull request #8978 from kenjis/fix-docs-nesting-group-filter
Browse files Browse the repository at this point in the history
docs: fix incorrect description for route group filter
  • Loading branch information
kenjis authored Jun 21, 2024
2 parents d6d1434 + b9afd48 commit 53bfdef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions user_guide_src/source/incoming/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,14 @@ It is possible to nest groups within groups for finer organization if you need i

This would handle the URL at **admin/users/list**.

**Filter** option passed to the outer ``group()`` are merged with the inner
The ``filter`` option passed to the outer ``group()`` are merged with the inner
``group()`` filter option.
The above code runs ``myfilter:config`` for the route ``admin``, and ``myfilter:config``
and ``myfilter:region`` for the route ``admin/users/list``.
The above code runs ``myfilter1:config`` for the route ``admin``, and ``myfilter1:config``
and ``myfilter2:region`` for the route ``admin/users/list``.

Any other overlapping options passed to the inner `group()` will overwrite their values.
.. note:: The same filter cannot be run multiple times with different arguments.

Any other overlapping options passed to the inner ``group()`` will overwrite their values.

.. note:: Prior to v4.5.0, due to a bug, options passed to the outer ``group()``
are not merged with the inner ``group()`` options.
Expand Down
4 changes: 2 additions & 2 deletions user_guide_src/source/incoming/routing/026.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

$routes->group('admin', ['filter' => 'myfilter:config'], static function ($routes) {
$routes->group('admin', ['filter' => 'myfilter1:config'], static function ($routes) {
$routes->get('/', 'Admin\Admin::index');

$routes->group('users', ['filter' => 'myfilter:region'], static function ($routes) {
$routes->group('users', ['filter' => 'myfilter2:region'], static function ($routes) {
$routes->get('list', 'Admin\Users::list');
});
});

0 comments on commit 53bfdef

Please sign in to comment.