flipboxstudio / lumen-generator

A Lumen Generator You Are Missing
https://packagist.org/packages/flipbox/lumen-generator
MIT License
823 stars 126 forks source link

Fix for php artisan route:list #19

Closed Barry-Fisher closed 7 years ago

Barry-Fisher commented 7 years ago

For starters: Thank you for creating this extension for lumen. I'm trying out lumen to strip down an existing Laravel app and I'm immediately missing a few things. This extension helps fill the gap - so thanks so far.

On to issue at hand:

Expected behavior:

What's happening?:

  [Symfony\Component\Debug\Exception\FatalThrowableError]          
  Call to undefined method Laravel\Lumen\Application::getRoutes()                                                                

Note: I have the Lumen 5.5 patch applied from @joelhy 's lumen5.5_compatiblity fork + branch.

To resolve:

The RouteListCommand.php appears to reference getRoutes() directly on the $laravel property.

At the moment the offending line is:

$routeCollection = $this->laravel->getRoutes();

...but it should be:

$routeCollection = $this->laravel->router->getRoutes();

Given this is already forked, please could @joelhy or another maintainer merge this in as part of the 5.5 compatibility efforts?:

diff --git a/src/LumenGenerator/Console/RouteListCommand.php b/src/LumenGenerator/Console/RouteListCommand.php
index 938ebe9..98ea9a6 100644
--- a/src/LumenGenerator/Console/RouteListCommand.php
+++ b/src/LumenGenerator/Console/RouteListCommand.php
@@ -40,7 +40,7 @@ class RouteListCommand extends Command
      */
     public function handle()
     {
-        $routeCollection = $this->laravel->getRoutes();
+        $routeCollection = $this->laravel->router->getRoutes();
         $rows = array();

         foreach ($routeCollection as $route) {

Thanks! Barry

joelhy commented 7 years ago

I will look into it later today.

joelhy commented 7 years ago

artisan route:list Lumen v5.5 compatibility fixed. Please see #17

aqidd commented 7 years ago

17 is already merged so this issue should be closed