Skip to content

Commit

Permalink
Merge pull request #694 from williamxsp/patch-1
Browse files Browse the repository at this point in the history
DOC: New sample with multiple default sorts
  • Loading branch information
freekmurze authored Nov 22, 2021
2 parents d81a10d + 5d2c277 commit 9400766
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/features/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ $users = QueryBuilder::for(User::class)
// Will retrieve the users sorted descendingly by name
```

You can define multiple default sorts

```php
// GET /users
$users = QueryBuilder::for(User::class)
->defaultSort('-street', 'name')
->allowedSorts('name', 'street')
->get();

// Will retrieve the users sorted descendingly by street than in ascending order by name
```

You can sort by multiple properties by separating them with a comma:

```php
Expand Down

0 comments on commit 9400766

Please sign in to comment.