[英]laravel graphql playground got error when i setup it
在灯塔教程中设置此软件包时,出现此错误,我现在该怎么办?
https://github.com/mll-lab/laravel-graphql-playground
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.7.*",
"laravel/tinker": "^1.0",
"mll-lab/laravel-graphql-playground": "^1.0",
"nuwave/lighthouse": "^2.6"
},
In Router.php line 363:
Argument 1 passed to Illuminate\Routing\Router::group() must be of the type array, string giv en,
called in D:\Laravel\lighthouse-tutorial\vendor\laravel\framework\src\Illuminate\Support\ Facades\Facade.php on line 223
--
In Router.php line 363:
Argument 1 passed to Illuminate\Routing\Router::group() must be of the type
array, string given, called in D:\Laravel\lighthouse-tutorial\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 223
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with er ror code 1
--
配置文件
<?php
return [
// Route for the frontend
'route' => 'graphql-playground',
// Which middleware to apply, if any
'middleware' => [
// 'web',
],
// Route for the GraphQL endpoint
'endpoint' => 'graphql',
// Control if the playground is accessible at all
// This allows you to disable it completely in production
'enabled' => env('GRAPHQL_PLAYGROUND_ENABLED', true),
];
问题出在这里,当我删除它正在工作的'route' => 'graphql-playground',
我发现在GraphQLPlaygroundServiceProvider.php
他们正在使用路由组:
Route::group(
config('graphql-playground.route'),
...
但是路由组需要一个数组参数,因此我通过将配置文件从以下位置更改来解决了该问题:
'route' => 'graphql-playground',
以数组的形式到达路由:
'route' => ['graphql-playground'],
这为我解决了这个问题。
问题解释:
这是在灯塔教程的回购中发生的,当我尝试遵循以下说明时,我发现这是因为配置文件正在返回期望数组的字符串。
固定
转到灯塔教程仓库的config / graphql-playground.php并将'route' => 'graphql-playground'
更改为'route' => ['graphql-playground']
然后运行您的composer require nuwave/lighthouse mll-lab/laravel-graphql-playground
。
这为我解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.