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);
    }

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

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
最佳答案

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

添加 这段代码

public function flushMiddlewareGroups()

 {

   return $this;

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

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

5年前 评论

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

添加 这段代码

public function flushMiddlewareGroups()

 {

   return $this;

 }
5年前 评论

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