Skip to content

Commit

Permalink
Merge pull request #104 from n1crack/dev
Browse files Browse the repository at this point in the history
fix individual filter
  • Loading branch information
n1crack authored Jun 7, 2024
2 parents de67860 + 35e4a64 commit a87e32b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,16 @@ protected function filter(Query $query): string
*/
protected function filterGlobal(Query $query): string
{
$searchinput = preg_replace("/\W+/u", ' ', $this->options->searchValue());
$searchInput = preg_replace("/\W+/u", ' ', $this->options->searchValue());
$columns = $this->columns->searchable();

if ($searchinput === null || $searchinput === '' || \count($columns) === 0) {
if ($searchInput === null || $searchInput === '' || \count($columns) === 0) {
return '';
}

$search = [];

foreach (explode(' ', $searchinput) as $word) {
foreach (explode(' ', $searchInput) as $word) {
$look = [];

foreach ($columns as $column) {
Expand All @@ -253,6 +253,8 @@ protected function filterIndividual(Query $query): string
$look[] = $this->columnFilter($column, new FilterHelper($query, $column, $this->db));
}

$look = array_filter($look);

return implode(' AND ', $look);
}

Expand Down Expand Up @@ -325,4 +327,4 @@ public function columnFilter(Column $column, FilterHelper $helper): string

return $helper->defaultFilter();
}
}
}

0 comments on commit a87e32b

Please sign in to comment.