Skip to content

Commit 01a8b3f

Browse files
committed
Register the routes for the route command in the fire method.
Signed-off-by: Jason Lewis <[email protected]>
1 parent d8ab5f4 commit 01a8b3f

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/Console/Command/Routes.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111

1212
class Routes extends RouteListCommand
1313
{
14+
/**
15+
* Dingo router instance.
16+
*
17+
* @var \Dingo\Api\Routing\Router
18+
*/
19+
protected $router;
20+
1421
/**
1522
* Array of route collections.
1623
*
@@ -52,7 +59,19 @@ public function __construct(Router $router)
5259
// constructor on the command class.
5360
Command::__construct();
5461

55-
$this->routes = $router->getRoutes();
62+
$this->router = $router;
63+
}
64+
65+
/**
66+
* Execute the console command.
67+
*
68+
* @return void
69+
*/
70+
public function fire()
71+
{
72+
$this->routes = $this->router->getRoutes();
73+
74+
parent::fire();
5675
}
5776

5877
/**
@@ -64,7 +83,7 @@ protected function getRoutes()
6483
{
6584
$routes = [];
6685

67-
foreach ($this->routes as $collection) {
86+
foreach ($this->router->getRoutes() as $collection) {
6887
foreach ($collection->getRoutes() as $route) {
6988
$routes[] = $this->filterRoute([
7089
'host' => $route->domain(),

0 commit comments

Comments
 (0)