From 32a1754914642156a8cb752379545d22556f7b29 Mon Sep 17 00:00:00 2001 From: Hassan Althaf Date: Tue, 15 Aug 2017 14:22:24 +0530 Subject: [PATCH] Fixed issues with backticks I removed backticks generated in SQL queries due to it being incompatible with certain SQL flavors and of course it is not needed by any SQL flavor. --- src/LiveControl/EloquentDataTable/DataTable.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/LiveControl/EloquentDataTable/DataTable.php b/src/LiveControl/EloquentDataTable/DataTable.php index f1fd4c1..9cd3b0b 100644 --- a/src/LiveControl/EloquentDataTable/DataTable.php +++ b/src/LiveControl/EloquentDataTable/DataTable.php @@ -236,7 +236,7 @@ private function addSelect() $rawSelect = []; foreach ($this->columns as $index => $column) { if (isset($this->rawColumns[$index])) { - $rawSelect[] = $this->rawColumns[$index] . ' as ' . Model::resolveConnection()->getQueryGrammar()->wrap($this->columnNames[$index]); + $rawSelect[] = trim($this->rawColumns[$index], '`') . ' as ' . trim(Model::resolveConnection()->getQueryGrammar()->wrap($this->columnNames[$index]), '`'); } } $this->builder = $this->builder->select(new raw(implode(', ', $rawSelect))); @@ -286,7 +286,7 @@ private function addAllFilter($search) function ($query) use ($search) { foreach ($this->columns as $column) { $query->orWhere( - new raw($this->getRawColumnQuery($column)), + trim(new raw($this->getRawColumnQuery($column)), '`'), 'like', '%' . $search . '%' ); @@ -303,7 +303,7 @@ private function addColumnFilters() foreach ($this->columns as $i => $column) { if (static::$versionTransformer->isColumnSearched($i)) { $this->builder->where( - new raw($this->getRawColumnQuery($column)), + trim(new raw($this->getRawColumnQuery($column)), '`'), 'like', '%' . static::$versionTransformer->getColumnSearchValue($i) . '%' );