Skip to content

Commit 8250af0

Browse files
committed
Support for fluent queries in saveQuery()
1 parent 53dbb3d commit 8250af0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Bllim/Datatables/Datatables.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,13 @@ protected function saveQuery($query)
357357
$this->query = $query;
358358
$this->query_type = $query instanceof \Illuminate\Database\Query\Builder ? 'fluent' : 'eloquent';
359359
if ($this->dataFullSupport) {
360-
$this->columns = array_map(function ($column) {
361-
return trim(DB::connection()->getPdo()->quote($column['data']), "'");
362-
}, $this->input['columns']);
360+
if ($this->query_type == 'eloquent') {
361+
$this->columns = array_map(function ($column) {
362+
return trim(DB::connection()->getPdo()->quote($column['data']), "'");
363+
}, $this->input['columns']);
364+
} else {
365+
$this->columns = ($this->query->columns ?: array());
366+
}
363367
} else {
364368
$this->columns = $this->query_type == 'eloquent' ? ($this->query->getQuery()->columns ?: array()) : ($this->query->columns ?: array());
365369
}

0 commit comments

Comments
 (0)