From 2bdbb7643fc4ce29255ab12bcedcd930fcff0735 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 26 Sep 2023 15:51:57 +0900 Subject: [PATCH] docs: update docs --- user_guide_src/source/incoming/routing.rst | 10 +++++++++- user_guide_src/source/incoming/routing/026.php | 5 +++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index f956c68fb4df..74c8983e83d0 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -544,7 +544,15 @@ It is possible to nest groups within groups for finer organization if you need i This would handle the URL at **admin/users/list**. -.. note:: Options passed to the outer ``group()`` (for example ``namespace`` and ``filter``) are not merged with the inner ``group()`` options. +Options array passed to the outer ``group()`` are merged with the inner +``group()`` options array. But note that if you specify the same key in the +inner ``group()`` options, the value is overwritten. + +The above code runs ``myfilter:config`` for ``admin``, and only ``myfilter:region`` +for ``admin/users/list``. + +.. note:: Prior to v4.5.0, due to a bug, options passed to the outer ``group()`` + are not merged with the inner ``group()`` options. .. _routing-priority: diff --git a/user_guide_src/source/incoming/routing/026.php b/user_guide_src/source/incoming/routing/026.php index 1ed2a8a96ee6..5098325026cd 100644 --- a/user_guide_src/source/incoming/routing/026.php +++ b/user_guide_src/source/incoming/routing/026.php @@ -1,7 +1,8 @@ group('admin', static function ($routes) { - $routes->group('users', static function ($routes) { +$routes->group('admin', ['filter' => 'myfilter:config'], static function ($routes) { + $routes->get('/', 'Admin\Admin::index'); + $routes->group('users', ['filter' => 'myfilter:region'], static function ($routes) { $routes->get('list', 'Admin\Users::list'); }); });