From 251be5fb4a374d562f7120c3577673c5232d5bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 28 Jun 2022 14:43:14 +0300 Subject: [PATCH] fixed filter in reports #32gvfmf --- app/Abstracts/Model.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Abstracts/Model.php b/app/Abstracts/Model.php index 2d9b81761..9280c1155 100644 --- a/app/Abstracts/Model.php +++ b/app/Abstracts/Model.php @@ -113,11 +113,13 @@ abstract class Model extends Eloquent implements Ownable return $query->paginate($limit); } - public function scopeUsingSearchString($query) + public function scopeUsingSearchString(Builder $query, string|null $string = null) { event(new SearchStringApplying($query)); - $this->getSearchStringManager()->updateBuilder($query, request('search')); + $string = $string ?: request('search'); + + $this->getSearchStringManager()->updateBuilder($query, $string); event(new SearchStringApplied($query)); }