From bd246c37ddb3018514465ce84e21723fd66e9b8a Mon Sep 17 00:00:00 2001 From: Phan An Date: Thu, 17 Oct 2024 22:04:51 +0700 Subject: [PATCH] fix: broken search --- app/Repositories/Repository.php | 2 +- app/Services/SearchService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Repositories/Repository.php b/app/Repositories/Repository.php index d181ffb2..03d28b0e 100644 --- a/app/Repositories/Repository.php +++ b/app/Repositories/Repository.php @@ -15,7 +15,7 @@ use Illuminate\Support\Collection; abstract class Repository implements RepositoryInterface { /** @var class-string $modelClass */ - protected string $modelClass; + public string $modelClass; protected Guard $auth; diff --git a/app/Services/SearchService.php b/app/Services/SearchService.php index 268b59fa..80b1a43b 100644 --- a/app/Services/SearchService.php +++ b/app/Services/SearchService.php @@ -52,7 +52,7 @@ class SearchService { try { return $repository->getMany( - ids: $repository->model::search($keywords)->get()->take($count)->pluck('id')->all(), // @phpstan-ignore-line + ids: $repository->modelClass::search($keywords)->get()->take($count)->pluck('id')->all(), // @phpstan-ignore-line preserveOrder: true, ); } catch (Throwable $e) {