Я установил пакет rebing/graphql-laravel версии 5.1.4. Когда я пытаюсь передать через почтальона запрос на получение всех продуктов, я получаю сообщение об ошибке
namespace App\GraphQL\Queries;
use App\Models\Product;
use GraphQL\Type\Definition\Type;
use Rebing\GraphQL\Support\Facades\GraphQL;
use Rebing\GraphQL\Support\Query;
class ProductQuery extends Query
{
protected $attributes = [
'name' => 'product',
'description' => 'A query'
];
/**
* Return type for these query
* @return Type
*/
public function type(): Type
{
return GraphQL::type('Product');
}
/**
* Passed arguments for this query
* @return array
*/
public function args(): array
{
return [
'slug' => [
'name' => 'slug',
'type' => Type::nonNull(Type::string()),
'rules' => ['required']
],
];
}
/**
* Resolve Query to get pass an information
* @param mixed $root
* @param array $args
* @return Product
*/
public function resolve($root, array $args): Product
{
return Product::where('slug', $args['slug'])->first();
}
}
Я установил пакет rebing/graphql-laravel версии 5.1.4. Когда я пытаюсь передать через почтальона запрос на получение всех продуктов, я получаю сообщение об ошибке [code]"Cannot query field \"products\" on type \"Query\". Did you mean \"product\"?"[/code] Моя структура папок [img]https://i.sstatic .net/LyRXq.png[/img]