我正在使用"nuwave/lighthouse": "^4.14"
并根据此功能的文档使用此 schema.graphql :
type Query {
# ...
postsWithUnseenComments(orderBy: _ @orderBy(columns: ["id", "created_at"], order: ASC), hasComments: _ @whereHasConditions(columns: ["user_id", "seen_at"])): [Post!]! @paginate(defaultCount: 20) @cache
}
我收到这个错误:
No directive found for `whereHasConditions` {"exception":"[object] (Nuwave\\Lighthouse\\Exceptions\\DirectiveException(code: 0): No directive found for `whereHasConditions` at C:\\code\\myproject\\vendor\
uwave\\lighthouse\\src\\Schema\\Factories\\DirectiveFactory.php:91)
我已经php artisan package:discover
从这里尝试过,但没有帮助。
我从应该自动加载的文档中知道vendor\nuwave\lighthouse\src\WhereConditions\WhereHasConditionsDirective.php
。
@spawnia,非常感谢您的精彩图书馆。我很感激任何关于我做错了什么的提示。谢谢。
来自https://lighthouse-php.com/4.14/eloquent/complex-where-conditions.html#setup:
这是一项实验性功能,默认情况下不包含在 Lighthouse 中。
将服务提供商添加到您的 config/app.php
'providers' => [
\Nuwave\Lighthouse\WhereConditions\WhereConditionsServiceProvider::class,
],
安装依赖mll-lab/graphql-php-scalars:
composer require mll-lab/graphql-php-scalars
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句