From 70379a94132f4a21fb5f4430aa757bc7f33b51e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E6=89=AC?= <3280204+ycrao@users.noreply.github.com> Date: Thu, 25 Dec 2025 10:03:43 +0800 Subject: [PATCH] Update RouteCommand.php fix return Bad Middleware when using class string name --- flight/commands/RouteCommand.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flight/commands/RouteCommand.php b/flight/commands/RouteCommand.php index 8b5408e..bbcf52e 100644 --- a/flight/commands/RouteCommand.php +++ b/flight/commands/RouteCommand.php @@ -65,7 +65,11 @@ class RouteCommand extends AbstractBaseCommand if (!empty($route->middleware)) { try { $middlewares = array_map(function ($middleware) { - $middleware_class_name = explode("\\", get_class($middleware)); + if (is_string($middleware)) { + $middleware_class_name = explode("\\", $middleware); + } else { + $middleware_class_name = explode("\\", get_class($middleware)); + } return preg_match("/^class@anonymous/", end($middleware_class_name)) ? 'Anonymous' : end($middleware_class_name); }, $route->middleware); } catch (\TypeError $e) {