From 3f4a0d4c59ba9a1d9f699ed0f6cca40143a83fb5 Mon Sep 17 00:00:00 2001 From: brusnitsyn Date: Thu, 18 Dec 2025 22:40:11 +0900 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=D0=B0?= =?UTF-8?q?=20=3D=20=D0=9D=D0=B5=D1=82=20=D0=B2=20=D0=B0=D1=80=D1=85=D0=B8?= =?UTF-8?q?=D0=B2=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Repositories/MedicalHistoryRepository.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Repositories/MedicalHistoryRepository.php b/app/Repositories/MedicalHistoryRepository.php index 0704fc6..8befa78 100644 --- a/app/Repositories/MedicalHistoryRepository.php +++ b/app/Repositories/MedicalHistoryRepository.php @@ -5,6 +5,7 @@ namespace App\Repositories; use App\Models\SI\SttMedicalHistory as SiMedicalHistory; use App\Models\Mis\SttMedicalHistory as MisMedicalHistory; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; @@ -221,12 +222,16 @@ class MedicalHistoryRepository }); } - private function applyStatusFilter($query, ?int $value) + private function applyStatusFilter(Builder $query, ?int $value) { - if ($query->withExists('archiveInfo') && !empty($value)) { - $query->withWhereHas('archiveInfo', function ($q) use ($value) { - $q->where('status_id', '=', $value); - }); + if ($value === 0) { + $query->doesntHave('archiveInfo'); + } else { + if ($query->withExists('archiveInfo') && !empty($value)) { + $query->withWhereHas('archiveInfo', function ($q) use ($value) { + $q->where('status_id', '=', $value); + }); + } } }