From 7a885ef4a1743e5df5d65a4defc562ea1a049cbb Mon Sep 17 00:00:00 2001 From: ivan-sim Date: Thu, 17 Oct 2024 14:55:36 +0700 Subject: [PATCH] Update --- .../Http/Controllers/ApotekController.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Modules/HospitalPortal/Http/Controllers/ApotekController.php b/Modules/HospitalPortal/Http/Controllers/ApotekController.php index 2e732ab0..3322e795 100644 --- a/Modules/HospitalPortal/Http/Controllers/ApotekController.php +++ b/Modules/HospitalPortal/Http/Controllers/ApotekController.php @@ -51,10 +51,13 @@ class ApotekController extends Controller $query->where('tx_prescriptions.dTanggalresep', '<', $start_date); }); }) - ->when($request->input('status') && $request->input('status') != 'all', function ($query, $status) { - $query->where(function ($query) use ($status) { - $query->where('tx_prescription_orders.sStatus', '=', $status); - }); + ->when($request->input('status'), function ($query, $status) { + // Apply the filter if 'status' has a value + if ($status !== 'all') { + $query->where(function ($query) use ($status) { + $query->where('tx_prescription_orders.sStatus', '=', $status); + }); + } }) ->select( 'tx_prescriptions.nID as id',