Dingo API 使用命令行artisan出错

### laravel8.5版本composer,Dongo Api后使用 Dongo API命令行工具

## 执行 php artisan api:routes 会报错。

Call to undefined method Dingo\Api\Routing\Router::flushMiddlewareGroups()

找到这个方法

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle()
    {
        $this->router->flushMiddlewareGroups();

        if (empty($this->router->getRoutes())) {
            return $this->error("Your application doesn't have any routes.");
        }

        if (empty($routes = $this->getRoutes())) {
            return $this->error("Your application doesn't have any routes matching the given criteria.");
        }

        $this->displayRoutes($routes);
    }

通过检查命名空间没发现问题,不知道为什么会报找不到方法。

《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
最佳答案

贴出来的就是报错代码,已经解决。
找到vendor\dingo\api\src\Routing\Router.php

添加 这段代码

public function flushMiddlewareGroups()

 {

   return $this;

 }
4年前 评论
讨论数量: 2
zhouyg

把报错详情以及报错部分代码贴出来

4年前 评论

贴出来的就是报错代码,已经解决。
找到vendor\dingo\api\src\Routing\Router.php

添加 这段代码

public function flushMiddlewareGroups()

 {

   return $this;

 }
4年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!