flipboxstudio / lumen-generator

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

Method getMiddleware does not exist. #25

Closed iiiyu closed 6 years ago

iiiyu commented 6 years ago

I used

"dingo/api": "2.0.0-alpha1"

and route/web.php

$api = app('Dingo\Api\Routing\Router');

$api->version('v1', function ($api) {
    $api->get('/test', [
        'as' => 'index',
        'uses' => 'App\Http\Controllers\Controller@getIndex',
    ]);
});

When i am executing:

php artisan route:list

It returns a message:

In Macroable.php line 96:

  Method getMiddleware does not exist.
joelhy commented 6 years ago

Are you sure it is caused by Lumen generator? Maybe you should open an issue in dingo/api.

gazben commented 6 years ago

@iiiyu I created a pull request to address this issue.

If you add the function the command output will be something like this:

+----------+---------------------+--------------+------------------------------------------+------------------+------------------------------+
| Verb     | Path                | NamedRoute   | Controller                               | Action           | Middleware                   |
+----------+---------------------+--------------+------------------------------------------+------------------+------------------------------+
| GET      | /                   |              | App\Http\Controllers\ServerController    | name             |                              |
| GET|HEAD | api/status/ping     |              | App\Http\Controllers\ServerController    | ping             | api.controllers|api.throttle |
| GET|HEAD | api/status/version  |              | App\Http\Controllers\ServerController    | version          | api.controllers|api.throttle |
thilanga commented 6 years ago

PR #1537 has been merged