Skip to content

Commit ac1241b

Browse files
authored
Merge pull request #3125 from Laravel-Backpack/fix-get-table-with-prefix
[4.1] Fix for getting table name with prefix.
2 parents d31e11a + 31e3795 commit ac1241b

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->orderByRaw($this->crud->model->getTable().'.'.$column['name'].' '.$column_direction);
103+
$this->crud->query->orderByRaw($this->crud->model->getTableWithPrefix().'.'.$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->orderByRaw($this->crud->model->getTable().'.'.$this->crud->model->getKeyName().' DESC');
129+
$this->crud->query->orderByRaw($this->crud->model->getTableWithPrefix().'.'.$this->crud->model->getKeyName().' DESC');
130130
}
131131

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

0 commit comments

Comments
 (0)