From f8641cfc5ee4cfa5bfddfaaccc2c33187cd5e783 Mon Sep 17 00:00:00 2001 From: Broutard Date: Thu, 9 May 2019 12:36:09 +0200 Subject: [PATCH] Fix route:list when routes were dynamically modified When routes are modified by a custom service (like a Tenant service which modifies the routes domain, for example), the routes list displayed by this command remained unchanged. --- src/Illuminate/Foundation/Console/RouteListCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Foundation/Console/RouteListCommand.php b/src/Illuminate/Foundation/Console/RouteListCommand.php index 02a416c205c7..15bf82c4bd33 100644 --- a/src/Illuminate/Foundation/Console/RouteListCommand.php +++ b/src/Illuminate/Foundation/Console/RouteListCommand.php @@ -57,7 +57,7 @@ public function __construct(Router $router) { parent::__construct(); - $this->routes = $router->getRoutes(); + $this->router = $router; } /** @@ -67,7 +67,7 @@ public function __construct(Router $router) */ public function handle() { - if (empty($this->routes)) { + if (empty($this->router->getRoutes())) { return $this->error("Your application doesn't have any routes."); } @@ -85,7 +85,7 @@ public function handle() */ protected function getRoutes() { - $routes = collect($this->routes)->map(function ($route) { + $routes = collect($this->router->getRoutes())->map(function ($route) { return $this->getRouteInformation($route); })->filter()->all();