在灯塔教程中设置此软件包时,出现此错误 我现在能做什么?
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',
答案 0 :(得分:0)
我发现他们在GraphQLPlaygroundServiceProvider.php
中使用的是路由组:
Route::group(
config('graphql-playground.route'),
...
但是路由组需要一个数组参数,因此我通过将配置文件从以下位置更改来解决了这个问题:
'route' => 'graphql-playground',
以数组的形式到达路线:
'route' => ['graphql-playground'],
这为我解决了这个问题。
答案 1 :(得分:0)
问题解释:
这是在lighthouse-tutorial回购中发生的,当我尝试继续进行时,发现这是因为配置文件返回了一个期望数组的字符串。
FIX
转到灯塔教程仓库的config / graphql-playground.php并进行更改
'route' => 'graphql-playground'
至'route' => ['graphql-playground']
然后再次运行您的composer require nuwave/lighthouse mll-lab/laravel-graphql-playground
。
这为我修复了它。