Skip to content

Commit 74fdc2f

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

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Traits/WithSorting.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ public function applySorting($query)
5454
}
5555

5656
foreach ($this->sorts as $field => $direction) {
57-
if (optional($this->getColumn($field))->hasSortCallback()) {
57+
58+
$column = $this->getColumn($field);
59+
60+
if (is_null($column)) {
61+
continue;
62+
}
63+
64+
if (optional($column)->hasSortCallback()) {
5865
$query = app()->call($this->getColumn($field)->getSortCallback(), ['query' => $query, 'direction' => $direction]);
5966
} else {
6067
$query->orderBy($field, $direction);

0 commit comments

Comments
 (0)