Skip to content

Commit 51e9434

Browse files
authored
Update README.md
1 parent 58275f0 commit 51e9434

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,18 @@ $users = QueryBuilder::for(User::class)
349349
// Will retrieve the users sorted by name
350350
```
351351

352+
You can use `-` if you want to have the default order sorted descendingly.
353+
354+
``` php
355+
// GET /users
356+
$users = QueryBuilder::for(User::class)
357+
->defaultSort('-name')
358+
->allowedSorts('name', 'street')
359+
->get();
360+
361+
// Will retrieve the users sorted descendingly by name
362+
```
363+
352364
You can also pass in an array of sorts to the `allowedSorts()` method.
353365

354366
``` php

0 commit comments

Comments
 (0)