Skip to content

Commit df4ff78

Browse files
committed
fix order by to include table prefix
1 parent 84d9c9a commit df4ff78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/app/Http/Controllers/Operations/ListOperation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function search()
100100
// clear any past orderBy rules
101101
$this->crud->query->getQuery()->orders = null;
102102
// apply the current orderBy rules
103-
$this->crud->query->orderBy($column['name'], $column_direction);
103+
$this->crud->query->orderByRaw($this->crud->model->getTable() . '.' . $column['name'] . ' ' . $column_direction);
104104
}
105105

106106
// check for custom order logic in the column definition
@@ -126,7 +126,7 @@ public function search()
126126
}
127127
});
128128
if (! $hasOrderByPrimaryKey) {
129-
$this->crud->query->orderByDesc($this->crud->model->getKeyName());
129+
$this->crud->query->orderByRaw($this->crud->model->getTable() . '.' . $this->crud->model->getKeyName() . ' DESC');
130130
}
131131

132132
$entries = $this->crud->getEntries();

0 commit comments

Comments
 (0)