Skip to content
This repository was archived by the owner on Jan 9, 2024. It is now read-only.

Commit 73b7bd5

Browse files
committed
Make order by not break older scout versions
1 parent bd7750b commit 73b7bd5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Engines/MySQLEngine.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ public function search(Builder $builder)
5858

5959
$result['count'] = $query->count();
6060

61-
foreach ($builder->orders as $order) {
62-
$query->orderBy($order['column'], $order['direction']);
61+
if (property_exists($builder, 'orders') && !empty($builder->orders)) {
62+
foreach ($builder->orders as $order) {
63+
$query->orderBy($order['column'], $order['direction']);
64+
}
6365
}
6466

6567
if($builder->limit) {

0 commit comments

Comments
 (0)