Laravel 和 Lighthouse,它总是读取默认模式

Laravel and Lighthouse, it always read the dafault schema

我正在按照 Lighthouse 网站上的教程学习主版本 (4.1)。

https://lighthouse-php.com/4.1/getting-started/tutorial.html#installation

我重新安装了Laravel 5.8,然后我执行教程中写的命令(在npm install旁边)

composer require nuwave/lighthouse mll-lab/laravel-graphql-playground

php artisan vendor:publish --provider="Nuwave\Lighthouse\LighthouseServiceProvider"

php artisan vendor:publish --provider="MLL\GraphQLPlayground\GraphQLPlaygroundServiceProvider"

之后创建了一个 /graphql/schema.graphql 文件(在项目根目录下,而不是像以前的版本那样在 routes 文件夹下)。

现在我用一些数据填充数据库,然后我 copy/paste 从教程页面到发布的模式的模式,我启动服务器,然后我访问显示正确 url 的游乐场将请求发送到哪里 http://127.0.0.1:8000/graphql.

单击 Schema 选项卡,我总是看到默认架构,而不是 /graphql/schema.graphql 中发布的架构,当然,对与用户不同的资源的查询失败,并出现类似 Cannot query field "posts" on type "Query".。我已经尝试过重新启动服务器并刷新 Playground 页面。

config/lighthouse.php 文件中,架构注册到看起来正确的路径 base_path('graphql/schema.graphql')

为什么 Playground 总是显示默认架构而不是已发布和编辑的架构?

我正在使用 PHP 7.2.14,Lighthouse 需要 PHP>7.1

我认为问题与缓存有关。我尝试将 LIGHTHOUSE_CACHE_ENABLE=false 添加到 laravel .env 文件并重新启动服务器,然后刷新 playground 页面。我重新检查架构,它已更新。

希望有用。