0

I'm running lighthouse for laravel and it's not working @orderBy, by default (without pass argument).

I follow that guide,

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

And doesn't work, just have the sort from 1 to 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"
      },.....

I use:

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
francisco
  • 1,387
  • 2
  • 12
  • 23
Agustin
  • 215
  • 1
  • 2
  • 14

1 Answers1

1

You have to be sure that you're running on Lighthouse v5.1.0, at least.

Enzo Notario
  • 639
  • 4
  • 9