Skip to content

Commit ebfe361

Browse files
committed
🚀 Fix invalid sort when trying to manual in url
Signed-off-by: Lloric Mayuga Garcia <[email protected]>
1 parent 7df7c00 commit ebfe361

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Traits/WithSorting.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public function applySorting($query)
5454
}
5555

5656
foreach ($this->sorts as $field => $direction) {
57+
58+
if (!in_array($direction, ['asc', 'desc'])) {
59+
$direction = 'desc';
60+
}
61+
5762
if (optional($this->getColumn($field))->hasSortCallback()) {
5863
$query = app()->call($this->getColumn($field)->getSortCallback(), ['query' => $query, 'direction' => $direction]);
5964
} else {

0 commit comments

Comments
 (0)