dingo / api

A RESTful API package for the Laravel and Lumen frameworks.
BSD 3-Clause "New" or "Revised" License
9.33k stars 1.25k forks source link

php artisan api:routes error on laravel 8 #1770

Closed cacing69 closed 3 years ago

cacing69 commented 3 years ago
Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 8.12
Package version 3.0.5
PHP version 7.4.15

Actual Behaviour

i got error when use command php artisan api:route

Expected Behaviour

it must show route api list image

xuechu commented 3 years ago

me too. Framework version 8.28.0

xuechu commented 3 years ago

v8.28.0 Fixed Fix undefined property with sole query (#36216) Resolving non-instantiables corrupts Container::$with (#36212) Fix attribute nesting on anonymous components (#36240) Ensure $prefix is a string (#36254) Add missing import (#34569) Align PHP 8.1 behavior of e() (#36262) Ensure null values won't break on PHP 8.1 (#36264) Handle directive $value as a string (#36260) Use explicit flag as default sorting (#36261)

Fix middleware group display (d9e28dc)

cherrynechou commented 3 years ago

me too.

hamza-younas94 commented 3 years ago

getting same error

mrodriguezt commented 3 years ago

me too

xbrunosousa commented 3 years ago

same here

cacing69 commented 3 years ago

but php artisan route:list, work for me,

gonpre commented 3 years ago

The issue is caused by the change done in this commit https://github.com/laravel/framework/commit/d9e28dcb1f4a5638b33829d919bd7417321ab39e

kfoon commented 3 years ago

The issue is caused by the change done in this commit laravel/framework@d9e28dc

so how do we resolve this?

gonpre commented 3 years ago

The issue is caused by the change done in this commit laravel/framework@d9e28dc

so how do we resolve this?

What I did was to add this code:

    /**
     * Flush the router's middleware groups.
     *
     * @return $this
     */
    public function flushMiddlewareGroups()
    {
        return $this;
    }

on the file vendor/dingo/api/src/Routing/Router.php to be able to run the api:routes command.

bastienuh commented 3 years ago

Thanks a lot, it fixed everything. Are you going to make a PR @gonpre?

gonpre commented 3 years ago

Thanks a lot, it fixed everything. Are you going to make a PR @gonpre?

yes, I already did, hope this could be merged soon

cacing69 commented 3 years ago

Thanks a lot, it fixed everything. Are you going to make a PR @gonpre?

yes, I already did, hope this could be merged soon

i will close this issue when yout PR has been merged

MrEldin commented 3 years ago

Will this ever be merged?

gonpre commented 3 years ago

Will this ever be merged?

no idea, meanwhile I changed my composer file to use my repo with the fix instead, maybe this will help you too

    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/gonpre/api"
        }
    ],
    "require": {
        "dingo/api": "dev-bugfix/1770_api_routes_error_laravel_8",
cacing69 commented 3 years ago

Will this ever be merged?

https://github.com/dingo/api/pull/1771#issuecomment-811459676 refer to this, maybe no

vytsci commented 3 years ago

Same issue here. Its stupid that such errors might occur, why Laravel does not provide any interface for router?

specialtactics commented 3 years ago

Hey guys, this fix is merged and tagged, thanks for your patience.

https://github.com/dingo/api/releases/tag/v3.0.6