GraphQL - Laravel - 默认为 OrderBy
GraphQL - Laravel - OrderBy by default
我是 运行 laravel 的灯塔,默认情况下它不工作 @orderBy
(没有传递参数)。
我遵循该指南,
https://lighthouse-php.com/master/api-reference/directives.html#orderby
Predefined Ordering To predefine a default order for your field, use
this directive on a field:
type Query { latestUsers: [User!]! @all @orderBy(column: "created_at", direction: DESC) }
Clients won't have to pass any arguments to the field and still receive ordered results by default
并没有用,只是从 1 到 10 排序
{
"data": {
"latestUsers": [
{
"id": "1",
"createdAt": "2021-06-22 18:35:13"
},
{
"id": "2",
"createdAt": "2021-06-22 18:35:13"
},
{
"id": "3",
"createdAt": "2021-06-22 18:35:13"
},.....
我使用:
Checking platform requirements for packages in the vendor dir
ext-ctype 7.4.19 success
ext-date 7.4.19 success
ext-dom 20031129 success
ext-fileinfo 7.4.19 success
ext-filter 7.4.19 success
ext-gd 7.4.19 success
ext-hash 7.4.19 success
ext-iconv 7.4.19 success
ext-json 7.4.19 success
ext-libxml 7.4.19 success
ext-mbstring 7.4.19 success
ext-openssl 7.4.19 success
ext-pcre 7.4.19 success
ext-phar 7.4.19 success
ext-simplexml 7.4.19 success
ext-spl 7.4.19 success
ext-tokenizer 7.4.19 success
ext-xml 7.4.19 success
ext-xmlreader 7.4.19 success
ext-xmlwriter 7.4.19 success
ext-zip 1.15.6 success
ext-zlib 7.4.19 success
lib-pcre 10.35 success
php 7.4.19 success
您至少必须确保 运行 在 Lighthouse v5.1.0。
我是 运行 laravel 的灯塔,默认情况下它不工作 @orderBy
(没有传递参数)。
我遵循该指南,
https://lighthouse-php.com/master/api-reference/directives.html#orderby
Predefined Ordering To predefine a default order for your field, use this directive on a field:
type Query { latestUsers: [User!]! @all @orderBy(column: "created_at", direction: DESC) }
Clients won't have to pass any arguments to the field and still receive ordered results by default
并没有用,只是从 1 到 10 排序
{
"data": {
"latestUsers": [
{
"id": "1",
"createdAt": "2021-06-22 18:35:13"
},
{
"id": "2",
"createdAt": "2021-06-22 18:35:13"
},
{
"id": "3",
"createdAt": "2021-06-22 18:35:13"
},.....
我使用:
Checking platform requirements for packages in the vendor dir
ext-ctype 7.4.19 success
ext-date 7.4.19 success
ext-dom 20031129 success
ext-fileinfo 7.4.19 success
ext-filter 7.4.19 success
ext-gd 7.4.19 success
ext-hash 7.4.19 success
ext-iconv 7.4.19 success
ext-json 7.4.19 success
ext-libxml 7.4.19 success
ext-mbstring 7.4.19 success
ext-openssl 7.4.19 success
ext-pcre 7.4.19 success
ext-phar 7.4.19 success
ext-simplexml 7.4.19 success
ext-spl 7.4.19 success
ext-tokenizer 7.4.19 success
ext-xml 7.4.19 success
ext-xmlreader 7.4.19 success
ext-xmlwriter 7.4.19 success
ext-zip 1.15.6 success
ext-zlib 7.4.19 success
lib-pcre 10.35 success
php 7.4.19 success
您至少必须确保 运行 在 Lighthouse v5.1.0。