From 1426fa74efa0c91f0c814fc93aaca1a4c82735d7 Mon Sep 17 00:00:00 2001 From: Simon Asika Date: Sat, 9 Mar 2024 03:05:45 +0800 Subject: [PATCH] Fix default controller --- src/Core/Router/Route.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Core/Router/Route.php b/src/Core/Router/Route.php index 577eb6e4..7a812c10 100644 --- a/src/Core/Router/Route.php +++ b/src/Core/Router/Route.php @@ -269,7 +269,14 @@ public function compile(): Route $new->setOptions($options); if ($options['extra']['default_controller'] ?? null) { - $new->controller($options['extra']['default_controller']); + foreach ($new->options['handlers'] as $k => &$handler) { + if (is_string($handler)) { + $handler = [ + $options['extra']['default_controller'], + $handler + ]; + } + } } if ($options['extra']['default_view'] ?? null) {