Skip to content

Commit 24ba12d

Browse files
committed
Merge branch 'lloricode-bugfix/invalid-sort' into develop
2 parents a843204 + 908b14b commit 24ba12d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Traits/WithSorting.php

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

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

0 commit comments

Comments
 (0)