From 2c2a3cc4a64279a42aefe25781ce4b06238967ae Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Fri, 19 Sep 2025 16:54:48 +0800 Subject: [PATCH 01/18] feat: column control --- src/QueryDataTable.php | 70 +++++++++++++++++++++++++++++++++++---- src/Utilities/Request.php | 5 +++ 2 files changed, 68 insertions(+), 7 deletions(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 89095051..cd583da9 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -258,6 +258,7 @@ protected function filterRecords(): void } $this->columnSearch(); + $this->columnControlSearch(); $this->searchPanesSearch(); // If no modification between the original query and the filtered one has been made @@ -281,23 +282,78 @@ public function columnSearch(): void $columns = $this->request->columns(); foreach ($columns as $index => $column) { - $column = $this->getColumnName($index); + $columnName = $this->getColumnName($index); - if (is_null($column)) { + if (is_null($columnName)) { continue; } - if (! $this->request->isColumnSearchable($index) || $this->isBlacklisted($column) && ! $this->hasFilterColumn($column)) { + if (! $this->request->isColumnSearchable($index) || $this->isBlacklisted($columnName) && ! $this->hasFilterColumn($columnName)) { continue; } - if ($this->hasFilterColumn($column)) { + if ($this->hasFilterColumn($columnName)) { $keyword = $this->getColumnSearchKeyword($index, true); - $this->applyFilterColumn($this->getBaseQueryBuilder(), $column, $keyword); + $this->applyFilterColumn($this->getBaseQueryBuilder(), $columnName, $keyword); } else { - $column = $this->resolveRelationColumn($column); + $columnName = $this->resolveRelationColumn($columnName); $keyword = $this->getColumnSearchKeyword($index); - $this->compileColumnSearch($index, $column, $keyword); + $this->compileColumnSearch($index, $columnName, $keyword); + } + } + } + + public function columnControlSearch(): void + { + $columns = $this->request->columns(); + + foreach ($columns as $index => $column) { + $columnName = $this->getColumnName($index); + + if (is_null($columnName) || ! $column['searchable']) { + continue; + } + + if ($this->isBlacklisted($columnName)) { + continue; + } + + $columnControl = $this->request->columnControlSearch($index); + $value = $columnControl['value']; + $logic = $columnControl['logic']; + // $type = $columnControl['type']; -- currently unused + + if ($value || str_contains($logic, 'empty')) { + $operator = match ($logic) { + 'contains', 'notContains', 'starts', 'ends' => 'LIKE', + 'greaterThan' => '>', + 'lessThan' => '<', + 'greaterThanOrEqual' => '>=', + 'lessThanOrEqual' => '<=', + 'empty', 'notEmpty' => null, + default => '=', + }; + + switch ($logic) { + case 'contains': + case 'notContains': + $value = '%'.$value.'%'; + break; + case 'starts': + $value = $value.'%'; + break; + case 'ends': + $value = '%'.$value; + break; + } + + if (str_contains($logic, 'empty')) { + $this->query->whereNull($columnName, not: str_contains($logic, 'not')); + } elseif (str_contains($logic, 'not')) { + $this->query->whereNot($columnName, $operator, $value); + } else { + $this->query->where($columnName, $operator, $value); + } } } } diff --git a/src/Utilities/Request.php b/src/Utilities/Request.php index 203ed98c..19c89571 100644 --- a/src/Utilities/Request.php +++ b/src/Utilities/Request.php @@ -151,6 +151,11 @@ public function columnKeyword(int $index): string return $this->prepareKeyword($keyword); } + public function columnControlSearch(int $index): array + { + return request()->array("columns.$index.columnControl.search"); + } + /** * Prepare keyword string value. */ From 4308015d9d432662b047be0c0d8880dfec95c62d Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Fri, 19 Sep 2025 17:18:18 +0800 Subject: [PATCH 02/18] fix: error on initial draw --- src/QueryDataTable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index cd583da9..4e30303c 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -319,8 +319,8 @@ public function columnControlSearch(): void } $columnControl = $this->request->columnControlSearch($index); - $value = $columnControl['value']; - $logic = $columnControl['logic']; + $value = $columnControl['value'] ?? ''; + $logic = $columnControl['logic'] ?? 'equals'; // $type = $columnControl['type']; -- currently unused if ($value || str_contains($logic, 'empty')) { From ebd976cc81bb51a407453744ab65e2a89ce7c53d Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Fri, 19 Sep 2025 17:18:40 +0800 Subject: [PATCH 03/18] feat: support filterColumn --- src/QueryDataTable.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 4e30303c..942a440e 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -347,7 +347,9 @@ public function columnControlSearch(): void break; } - if (str_contains($logic, 'empty')) { + if ($this->hasFilterColumn($columnName)) { + $this->applyFilterColumn($this->getBaseQueryBuilder(), $columnName, $value); + } elseif (str_contains($logic, 'empty')) { $this->query->whereNull($columnName, not: str_contains($logic, 'not')); } elseif (str_contains($logic, 'not')) { $this->query->whereNot($columnName, $operator, $value); From 7955a00be7d5fa7893f192b8630b590d01719a1e Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Sat, 20 Sep 2025 20:35:55 +0800 Subject: [PATCH 04/18] fix: lt and gt --- src/QueryDataTable.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 942a440e..8118de58 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -326,10 +326,10 @@ public function columnControlSearch(): void if ($value || str_contains($logic, 'empty')) { $operator = match ($logic) { 'contains', 'notContains', 'starts', 'ends' => 'LIKE', - 'greaterThan' => '>', - 'lessThan' => '<', - 'greaterThanOrEqual' => '>=', - 'lessThanOrEqual' => '<=', + 'greater' => '>', + 'less' => '<', + 'greaterOrEqual' => '>=', + 'lessOrEqual' => '<=', 'empty', 'notEmpty' => null, default => '=', }; From 87efac46f795e19e1ec42c900a69b9ba304e650e Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Sat, 20 Sep 2025 23:44:52 +0800 Subject: [PATCH 05/18] feat: date search --- src/QueryDataTable.php | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 8118de58..5b1b89e2 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Query\Expression; use Illuminate\Http\JsonResponse; +use Illuminate\Support\Carbon; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Str; @@ -321,7 +322,7 @@ public function columnControlSearch(): void $columnControl = $this->request->columnControlSearch($index); $value = $columnControl['value'] ?? ''; $logic = $columnControl['logic'] ?? 'equals'; - // $type = $columnControl['type']; -- currently unused + $type = $columnControl['type'] ?? 'string'; // string, num, date if ($value || str_contains($logic, 'empty')) { $operator = match ($logic) { @@ -331,6 +332,7 @@ public function columnControlSearch(): void 'greaterOrEqual' => '>=', 'lessOrEqual' => '<=', 'empty', 'notEmpty' => null, + 'notEqual' => '!=', default => '=', }; @@ -349,13 +351,29 @@ public function columnControlSearch(): void if ($this->hasFilterColumn($columnName)) { $this->applyFilterColumn($this->getBaseQueryBuilder(), $columnName, $value); - } elseif (str_contains($logic, 'empty')) { + + return; + } + + if (str_contains(strtolower($logic), 'empty')) { $this->query->whereNull($columnName, not: str_contains($logic, 'not')); - } elseif (str_contains($logic, 'not')) { + + return; + } + + if ($type === 'date') { + $this->query->whereDate($columnName, $operator, Carbon::parse($value)); + + return; + } + + if (str_contains($logic, 'not')) { $this->query->whereNot($columnName, $operator, $value); - } else { - $this->query->where($columnName, $operator, $value); + + return; } + + $this->query->where($columnName, $operator, $value); } } } From 1c1d3ae053abb84922b61869fcd2db9c9500899f Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Sun, 21 Sep 2025 00:28:58 +0800 Subject: [PATCH 06/18] fix: notEmpty and date mask --- src/QueryDataTable.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 5b1b89e2..a68b50a5 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -322,9 +322,10 @@ public function columnControlSearch(): void $columnControl = $this->request->columnControlSearch($index); $value = $columnControl['value'] ?? ''; $logic = $columnControl['logic'] ?? 'equals'; - $type = $columnControl['type'] ?? 'string'; // string, num, date + $mask = $columnControl['mask'] ?? ''; // for date type + $type = $columnControl['type'] ?? 'text'; // text, num, date - if ($value || str_contains($logic, 'empty')) { + if ($value || str_contains(strtolower($logic), 'empty')) { $operator = match ($logic) { 'contains', 'notContains', 'starts', 'ends' => 'LIKE', 'greater' => '>', @@ -356,13 +357,14 @@ public function columnControlSearch(): void } if (str_contains(strtolower($logic), 'empty')) { - $this->query->whereNull($columnName, not: str_contains($logic, 'not')); + $this->query->whereNull($columnName, not: $logic === 'notEmpty'); return; } if ($type === 'date') { - $this->query->whereDate($columnName, $operator, Carbon::parse($value)); + $value = $mask ? Carbon::createFromFormat($mask, $value) : Carbon::parse($value); + $this->query->whereDate($columnName, $operator, $value); return; } From 8f2ffbd9580270820385c592157d30b5b784799e Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Sun, 21 Sep 2025 00:34:01 +0800 Subject: [PATCH 07/18] chore: remove exceptions --- src/QueryDataTable.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index a68b50a5..e36d2bcb 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -772,10 +772,6 @@ public function addColumn($name, $content, $order = false): static /** * Perform search using search pane values. - * - * - * @throws \Psr\Container\ContainerExceptionInterface - * @throws \Psr\Container\NotFoundExceptionInterface */ protected function searchPanesSearch(): void { From 899187263d0c57206481ffa1aca4177db59e3dbc Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Sun, 21 Sep 2025 00:36:45 +0800 Subject: [PATCH 08/18] chore: throw exception on unsupported engine --- src/DataTableAbstract.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/DataTableAbstract.php b/src/DataTableAbstract.php index bd84c235..2f262621 100644 --- a/src/DataTableAbstract.php +++ b/src/DataTableAbstract.php @@ -10,6 +10,7 @@ use Psr\Log\LoggerInterface; use Yajra\DataTables\Contracts\DataTable; use Yajra\DataTables\Contracts\Formatter; +use Yajra\DataTables\Exceptions\Exception; use Yajra\DataTables\Processors\DataProcessor; use Yajra\DataTables\Utilities\Helper; @@ -730,10 +731,19 @@ protected function filterRecords(): void } $this->columnSearch(); + $this->columnControlSearch(); $this->searchPanesSearch(); $this->filteredCount(); } + /** + * @throws \Yajra\DataTables\Exceptions\Exception + */ + public function columnControlSearch(): void + { + throw new Exception('Column control search is not supported by this engine.'); + } + /** * Perform global search. */ From 06378e12f45ddbcc25b956c408315afc26724c08 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Sun, 21 Sep 2025 01:06:32 +0800 Subject: [PATCH 09/18] feat: searchDropdown list --- src/QueryDataTable.php | 26 +++++++++++++++++++------- src/Utilities/Request.php | 5 +++++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index e36d2bcb..6c4d0c91 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -319,13 +319,15 @@ public function columnControlSearch(): void continue; } - $columnControl = $this->request->columnControlSearch($index); - $value = $columnControl['value'] ?? ''; - $logic = $columnControl['logic'] ?? 'equals'; - $mask = $columnControl['mask'] ?? ''; // for date type - $type = $columnControl['type'] ?? 'text'; // text, num, date - - if ($value || str_contains(strtolower($logic), 'empty')) { + $columnControl = $this->request->columnControl($index); + $list = $columnControl['list'] ?? []; + $search = $columnControl['search'] ?? []; + $value = $search['value'] ?? ''; + $logic = $search['logic'] ?? 'equals'; + $mask = $search['mask'] ?? ''; // for date type + $type = $search['type'] ?? 'text'; // text, num, date + + if ($value || str_contains(strtolower($logic), 'empty') || $list) { $operator = match ($logic) { 'contains', 'notContains', 'starts', 'ends' => 'LIKE', 'greater' => '>', @@ -356,6 +358,16 @@ public function columnControlSearch(): void return; } + if (is_array($list) && count($list) > 0) { + if (str_contains($logic, 'not')) { + $this->query->whereNotIn($columnName, $list); + } else { + $this->query->whereIn($columnName, $list); + } + + return; + } + if (str_contains(strtolower($logic), 'empty')) { $this->query->whereNull($columnName, not: $logic === 'notEmpty'); diff --git a/src/Utilities/Request.php b/src/Utilities/Request.php index 19c89571..fa305b32 100644 --- a/src/Utilities/Request.php +++ b/src/Utilities/Request.php @@ -151,6 +151,11 @@ public function columnKeyword(int $index): string return $this->prepareKeyword($keyword); } + public function columnControl(int $index): array + { + return request()->array("columns.$index.columnControl"); + } + public function columnControlSearch(int $index): array { return request()->array("columns.$index.columnControl.search"); From 9f27b43aa8c219fc41154a883bc465dbdcdd834b Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Sun, 21 Sep 2025 01:10:50 +0800 Subject: [PATCH 10/18] fix: searching of zero (0) --- src/QueryDataTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 6c4d0c91..8c54afc1 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -327,7 +327,7 @@ public function columnControlSearch(): void $mask = $search['mask'] ?? ''; // for date type $type = $search['type'] ?? 'text'; // text, num, date - if ($value || str_contains(strtolower($logic), 'empty') || $list) { + if ($value != '' || str_contains(strtolower($logic), 'empty') || $list) { $operator = match ($logic) { 'contains', 'notContains', 'starts', 'ends' => 'LIKE', 'greater' => '>', From eb1e0d6dbe8695b57034c5998827258902af9384 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Sun, 21 Sep 2025 14:58:46 +0800 Subject: [PATCH 11/18] fix: continue searching on remaining columns --- src/QueryDataTable.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 8c54afc1..5279d4ff 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -355,7 +355,7 @@ public function columnControlSearch(): void if ($this->hasFilterColumn($columnName)) { $this->applyFilterColumn($this->getBaseQueryBuilder(), $columnName, $value); - return; + continue; } if (is_array($list) && count($list) > 0) { @@ -365,26 +365,26 @@ public function columnControlSearch(): void $this->query->whereIn($columnName, $list); } - return; + continue; } if (str_contains(strtolower($logic), 'empty')) { $this->query->whereNull($columnName, not: $logic === 'notEmpty'); - return; + continue; } if ($type === 'date') { $value = $mask ? Carbon::createFromFormat($mask, $value) : Carbon::parse($value); $this->query->whereDate($columnName, $operator, $value); - return; + continue; } if (str_contains($logic, 'not')) { $this->query->whereNot($columnName, $operator, $value); - return; + continue; } $this->query->where($columnName, $operator, $value); From 619cb1cc84ad1833ecffbaa2fd465b9b6b136542 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Sun, 21 Sep 2025 16:06:11 +0800 Subject: [PATCH 12/18] fix: notEqual with date --- src/QueryDataTable.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 5279d4ff..9d7953c7 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -323,7 +323,7 @@ public function columnControlSearch(): void $list = $columnControl['list'] ?? []; $search = $columnControl['search'] ?? []; $value = $search['value'] ?? ''; - $logic = $search['logic'] ?? 'equals'; + $logic = $search['logic'] ?? 'equal'; $mask = $search['mask'] ?? ''; // for date type $type = $search['type'] ?? 'text'; // text, num, date @@ -335,7 +335,6 @@ public function columnControlSearch(): void 'greaterOrEqual' => '>=', 'lessOrEqual' => '<=', 'empty', 'notEmpty' => null, - 'notEqual' => '!=', default => '=', }; @@ -376,7 +375,14 @@ public function columnControlSearch(): void if ($type === 'date') { $value = $mask ? Carbon::createFromFormat($mask, $value) : Carbon::parse($value); - $this->query->whereDate($columnName, $operator, $value); + + if ($logic === 'notEqual') { + $this->query->where(function ($q) use ($columnName, $value) { + $q->whereDate($columnName, '!=', $value)->orWhereNull($columnName); + }); + } else { + $this->query->whereDate($columnName, $operator, $value); + } continue; } From f1ac789071b9c08526a8728a88c6cee638819331 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Sun, 21 Sep 2025 17:21:38 +0800 Subject: [PATCH 13/18] fix: undefined variable searchable --- src/QueryDataTable.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 9d7953c7..079524b3 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -311,7 +311,7 @@ public function columnControlSearch(): void foreach ($columns as $index => $column) { $columnName = $this->getColumnName($index); - if (is_null($columnName) || ! $column['searchable']) { + if (is_null($columnName) || ! ($column['searchable'] ?? false)) { continue; } @@ -374,7 +374,11 @@ public function columnControlSearch(): void } if ($type === 'date') { - $value = $mask ? Carbon::createFromFormat($mask, $value) : Carbon::parse($value); + try { + $value = $mask ? Carbon::createFromFormat($mask, $value) : Carbon::parse($value); + } catch (\Exception $e) { + // can't parse date + } if ($logic === 'notEqual') { $this->query->where(function ($q) use ($columnName, $value) { From e85571a30f073c706511f0eef4edde062cd62e25 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Sun, 21 Sep 2025 21:33:13 +0800 Subject: [PATCH 14/18] fix: allow custom filters --- src/QueryDataTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 079524b3..e78c224d 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -315,7 +315,7 @@ public function columnControlSearch(): void continue; } - if ($this->isBlacklisted($columnName)) { + if ($this->isBlacklisted($columnName) && ! $this->hasFilterColumn($columnName)) { continue; } From b2aa1a6b192e150230cf42318e1657d1595d990d Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Wed, 24 Sep 2025 13:34:37 +0800 Subject: [PATCH 15/18] feat: convert list into comma separated keyword --- src/QueryDataTable.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index e78c224d..710efffa 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -352,12 +352,13 @@ public function columnControlSearch(): void } if ($this->hasFilterColumn($columnName)) { + $value = $list ? implode(', ', $list) : $value; $this->applyFilterColumn($this->getBaseQueryBuilder(), $columnName, $value); continue; } - if (is_array($list) && count($list) > 0) { + if ($list) { if (str_contains($logic, 'not')) { $this->query->whereNotIn($columnName, $list); } else { From 167e2aa3ad72ef4fb6ba70e76e2fe323afd40352 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Wed, 1 Oct 2025 10:14:55 +0800 Subject: [PATCH 16/18] chore: rector --- src/QueryDataTable.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 710efffa..ed507857 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -377,7 +377,7 @@ public function columnControlSearch(): void if ($type === 'date') { try { $value = $mask ? Carbon::createFromFormat($mask, $value) : Carbon::parse($value); - } catch (\Exception $e) { + } catch (\Exception) { // can't parse date } @@ -637,11 +637,11 @@ protected function getSelectedColumns($query): array ]; foreach ($q->columns ?? [] as $select) { - $sql = trim($select instanceof Expression ? $select->getValue($this->getConnection()->getQueryGrammar()) : $select); + $sql = trim((string) $select instanceof Expression ? $select->getValue($this->getConnection()->getQueryGrammar()) : $select); // Remove expressions $sql = preg_replace('/\s*\w*\((?:[^()]*|(?R))*\)/', '_', $sql); // Remove multiple spaces - $sql = preg_replace('/\s+/', ' ', $sql); + $sql = preg_replace('/\s+/', ' ', (string) $sql); // Remove wrappers $sql = str_replace(['`', '"', '[', ']'], '', $sql); // Loop on select columns From 0090df4460bf3b363358968c96597cd82f819002 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Wed, 1 Oct 2025 10:15:47 +0800 Subject: [PATCH 17/18] fix: static analysis --- src/QueryDataTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index ed507857..279db784 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -637,7 +637,7 @@ protected function getSelectedColumns($query): array ]; foreach ($q->columns ?? [] as $select) { - $sql = trim((string) $select instanceof Expression ? $select->getValue($this->getConnection()->getQueryGrammar()) : $select); + $sql = trim($select instanceof Expression ? $select->getValue($this->getConnection()->getQueryGrammar()) : (string) $select); // Remove expressions $sql = preg_replace('/\s*\w*\((?:[^()]*|(?R))*\)/', '_', $sql); // Remove multiple spaces From 5c10fd312612e9a5d68de79813945beb851ec0fd Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Wed, 1 Oct 2025 10:17:30 +0800 Subject: [PATCH 18/18] fix: do not throw error if column control is not yet supported --- src/DataTableAbstract.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/DataTableAbstract.php b/src/DataTableAbstract.php index 2f262621..0e51ed2b 100644 --- a/src/DataTableAbstract.php +++ b/src/DataTableAbstract.php @@ -10,7 +10,6 @@ use Psr\Log\LoggerInterface; use Yajra\DataTables\Contracts\DataTable; use Yajra\DataTables\Contracts\Formatter; -use Yajra\DataTables\Exceptions\Exception; use Yajra\DataTables\Processors\DataProcessor; use Yajra\DataTables\Utilities\Helper; @@ -736,12 +735,9 @@ protected function filterRecords(): void $this->filteredCount(); } - /** - * @throws \Yajra\DataTables\Exceptions\Exception - */ public function columnControlSearch(): void { - throw new Exception('Column control search is not supported by this engine.'); + // Not implemented in the abstract class. } /**