@@ -44,7 +44,7 @@ class Routes extends RouteListCommand
4444 *
4545 * @var array
4646 */
47- protected $ headers = ['Host ' , 'URI ' , 'Name ' , 'Action ' , 'Protected ' , 'Version(s) ' , 'Scope(s) ' , 'Rate Limit ' ];
47+ protected $ headers = ['Host ' , 'Method ' , ' URI ' , 'Name ' , 'Action ' , 'Protected ' , 'Version(s) ' , 'Scope(s) ' , 'Rate Limit ' ];
4848
4949 /**
5050 * Create a new routes command instance.
@@ -87,13 +87,14 @@ protected function getRoutes()
8787 foreach ($ collection ->getRoutes () as $ route ) {
8888 $ routes [] = $ this ->filterRoute ([
8989 'host ' => $ route ->domain (),
90- 'uri ' => implode ('| ' , $ route ->methods ()).' ' .$ route ->uri (),
90+ 'method ' => implode ('| ' , $ route ->methods ()),
91+ 'uri ' => $ route ->uri (),
9192 'name ' => $ route ->getName (),
9293 'action ' => $ route ->getActionName (),
9394 'protected ' => $ route ->isProtected () ? 'Yes ' : 'No ' ,
9495 'versions ' => implode (', ' , $ route ->versions ()),
9596 'scopes ' => implode (', ' , $ route ->scopes ()),
96- 'rate ' => $ this ->routeRateLimit ($ route ),
97+ 'rate ' => $ this ->routeRateLimit ($ route ),
9798 ]);
9899 }
99100 }
@@ -108,6 +109,14 @@ protected function getRoutes()
108109 $ routes = array_reverse ($ routes );
109110 }
110111
112+ if ($ this ->option ('short ' )) {
113+ $ this ->headers = ['Method ' , 'URI ' , 'Name ' , 'Version(s) ' ];
114+
115+ $ routes = array_map (function ($ item ) {
116+ return array_only ($ item , ['method ' , 'uri ' , 'name ' , 'versions ' ]);
117+ }, $ routes );
118+ }
119+
111120 return array_filter (array_unique ($ routes , SORT_REGULAR ));
112121 }
113122
@@ -173,6 +182,7 @@ protected function getOptions()
173182 ['scopes ' , 'S ' , InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL , 'Filter the routes by scopes ' ],
174183 ['protected ' , null , InputOption::VALUE_NONE , 'Filter the protected routes ' ],
175184 ['unprotected ' , null , InputOption::VALUE_NONE , 'Filter the unprotected routes ' ],
185+ ['short ' , null , InputOption::VALUE_NONE , 'Get an abridged version of the routes ' ],
176186 ]
177187 );
178188 }
0 commit comments