This commit is contained in:
ivan-sim
2024-10-17 14:55:36 +07:00
parent 888a364a22
commit 7a885ef4a1

View File

@@ -51,10 +51,13 @@ class ApotekController extends Controller
$query->where('tx_prescriptions.dTanggalresep', '<', $start_date); $query->where('tx_prescriptions.dTanggalresep', '<', $start_date);
}); });
}) })
->when($request->input('status') && $request->input('status') != 'all', function ($query, $status) { ->when($request->input('status'), function ($query, $status) {
$query->where(function ($query) use ($status) { // Apply the filter if 'status' has a value
$query->where('tx_prescription_orders.sStatus', '=', $status); if ($status !== 'all') {
}); $query->where(function ($query) use ($status) {
$query->where('tx_prescription_orders.sStatus', '=', $status);
});
}
}) })
->select( ->select(
'tx_prescriptions.nID as id', 'tx_prescriptions.nID as id',