Skip to content

Commit

Permalink
Update QueryBuilder.php
Browse files Browse the repository at this point in the history
  • Loading branch information
n1crack committed Jun 7, 2024
1 parent dee253e commit b0a3369
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 b0a3369

Please sign in to comment.