Report added filter => old and request inputs support

This commit is contained in:
Cüneyt Şentürk 2021-08-07 17:21:24 +03:00
parent 0289cb3b15
commit cfd4b0ce16
2 changed files with 37 additions and 0 deletions

View File

@ -27,6 +27,35 @@ class AddSearchString extends Listener
return; return;
} }
$old = old();
$request = request()->all();
if ($old || $request) {
$input = request('search');
$filters = [];
if ($input) {
$filters = explode(' ', $input);
}
foreach ($old as $key => $value) {
$filters[] = $key . ':' . $value;
}
foreach ($request as $key => $value) {
if ($key == 'search') {
continue;
}
$filters[] = $key . ':' . $value;
}
request()->merge([
'search' => implode(' ', $filters)
]);
}
// Apply search string // Apply search string
$this->applySearchStringFilter($event); $this->applySearchStringFilter($event);
} }

View File

@ -73,6 +73,14 @@
'value' => \Date::now()->year, 'value' => \Date::now()->year,
]; ];
} }
if (old($key) || request()->get($key)) {
$filtered[] = [
'option' => $key,
'operator' => '=',
'value' => old($key, request()->get($key)),
];
}
} }
@endphp @endphp