如何在查询中添加where条件?
projects: [Project!]! @all @orderBy(column: "id", direction: DESC)我想要:
projects: [Project!]! @all @orderBy(column: "id", direction: DESC) @where('parent_id','=',0)发布于 2021-07-25 09:54:44
Adding a where condition was too easy but was not clear in lighthouse docs.
projects(query: QueryCondition): [Project!]!
@all
@orderBy(column: "id", direction: DESC)
input QueryCondition {
parent_id: ID @eq
}发布于 2021-07-19 21:13:33
查看@ https://lighthouse-php.com/5/api-reference/directives.html#all指令上的scope参数并阅读有关https://laravel.com/docs/8.x/eloquent#query-scopes的内容。这就是你所需要的。@where指令只能在参数上传递。
https://stackoverflow.com/questions/68427271
复制相似问题