fixed an issue with the PSR-7 context

- the search filters were not emptied between requests resulting in wrong search results when searching anime/manga
This commit is contained in:
pushrbx 2023-03-08 17:30:41 +00:00
parent 21958f15b6
commit 9bc2e14d44
2 changed files with 5 additions and 3 deletions

View File

@ -140,7 +140,7 @@ class AppServiceProvider extends ServiceProvider
/* /*
* This bit is about a "mediator" pattern for handling requests. * This bit is about a "mediator" pattern for handling requests.
*/ */
$this->app->singleton(Mediator::class, DefaultMediator::class); $this->app->bind(Mediator::class, DefaultMediator::class);
/* /*
* Contextual binding for the mediator. * Contextual binding for the mediator.
* Each request is represented as a data transfer object, and spatie/laravel-data package's service provider * Each request is represented as a data transfer object, and spatie/laravel-data package's service provider
@ -378,7 +378,9 @@ class AppServiceProvider extends ServiceProvider
return [ return [
// in RoadRunner we want to reset the repositories after each request, because we cache the query builders in them. // in RoadRunner we want to reset the repositories after each request, because we cache the query builders in them.
// todo: refactor repositories to avoid caching query builders, so this step is not necessary // todo: refactor repositories to avoid caching query builders, so this step is not necessary
JikanUnitOfWork::class JikanUnitOfWork::class,
Mediator::class,
SearchService::class
]; ];
} }
} }

View File

@ -16,7 +16,7 @@ class RepositoryQuery extends RepositoryQueryBase implements RepositoryQueryCont
public function search(string $keywords, ?\Closure $callback = null): ScoutBuilder public function search(string $keywords, ?\Closure $callback = null): ScoutBuilder
{ {
return $this->searchable($keywords, $callback); return $this->searchable($keywords, $callback, true);
} }
public function where(string $key, mixed $value): Builder public function where(string $key, mixed $value): Builder