Skip to content

Commit

Permalink
Add Query String prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
dansysanalyst committed May 24, 2024
1 parent 44ca97b commit 4ccda3d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Concerns/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,17 @@ public function listColumnForFilters(): Collection
/*
@TODO Figure out
*/
protected function powerGridQueryString(): array
protected function powerGridQueryString(string $prefix = ''): array
{
$queryString = [];

$columns = $this->listColumnForFilters();

foreach (Arr::dot($this->filters()) as $filter) {
$as = str($filter->field)->replace('.', '_');
$as = str($filter->field)
->when(!empty($prefix), fn ($c) => $c->prepend($prefix . '_'))
->replace('.', '_')
->replaceMatches('/\_+/', '_');

if (!empty(request()->get($as))) {
$this->addEnabledFilters($filter->field, strval($columns->get($filter->field, $filter->field)));
Expand Down

0 comments on commit 4ccda3d

Please sign in to comment.