Skip to content

Commit ef3588b

Browse files
Fixed minor bugs and issue #1
1 parent 8b38f4e commit ef3588b

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "Eloquent DataTable plugin for server side ajax call handling.",
44
"keywords": [
55
"eloquent",
6+
"laravel",
67
"datatable"
78
],
89
"license": "MIT",

src/LiveControl/EloquentDataTable/DataTable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private function getRawColumnQuery($column)
189189
return 'CONCAT(' . implode(', " ", ', $this->getRawColumns($column)) . ')';
190190
}
191191

192-
return '`' . str_replace('.', '`.`', $column) . '`'; // user.firstname => `user`.`firstname`
192+
return Model::resolveConnection()->getQueryGrammar()->wrap($column);
193193
}
194194

195195
private function getDatabaseDriver()
@@ -202,7 +202,7 @@ private function addSelect()
202202
$rawSelect = [];
203203
foreach ($this->columns as $index => $column) {
204204
if ( isset($this->rawColumns[$index]) ) {
205-
$rawSelect[] = $this->rawColumns[$index] . ' AS `' . $this->columnNames[$index] . '`';
205+
$rawSelect[] = $this->rawColumns[$index] . ' as ' . Model::resolveConnection()->getQueryGrammar()->wrap($this->columnNames[$index]);
206206
}
207207
}
208208
$this->builder = $this->builder->select(new raw(implode(', ', $rawSelect)));

src/LiveControl/EloquentDataTable/VersionTransformers/Version110Transformer.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@ public function getSearchValue()
1717

1818
public function isColumnSearched($columnIndex)
1919
{
20-
return (isset($_POST['columns']) && isset($_POST['columns'][$columnIndex]) && isset($_POST['columns'][$columnIndex]['searchable']) && $_POST['columns'][$columnIndex]['searchable'] == 'true');
20+
return (
21+
isset($_POST['columns'])
22+
&&
23+
isset($_POST['columns'][$columnIndex])
24+
&&
25+
isset($_POST['columns'][$columnIndex]['search'])
26+
&&
27+
isset($_POST['columns'][$columnIndex]['search']['value'])
28+
&&
29+
$_POST['columns'][$columnIndex]['search']['value'] != ''
30+
);
2131
}
2232

2333
public function getColumnSearchValue($columnIndex)

0 commit comments

Comments
 (0)