update penjagaan edit log

This commit is contained in:
2024-01-29 10:46:05 +07:00
parent 2ce4a1efd1
commit c9d0e85449
3 changed files with 20 additions and 17 deletions

View File

@@ -64,11 +64,11 @@ class RequestLogController extends Controller
})
->when($request->orderBy, function ($q, $orderBy) use ($request) {
if (in_array($orderBy, ['submission_date', 'code'])) {
$q->orderBy($orderBy, $request->order);
$q->orderBy($orderBy, $request->orderBy);
}
})
->when(empty($request->orderBy), function ($q) {
$q->orderBy('created_at', 'desc');
$q->orderBy('submission_date', 'desc');
})
->when($request->service_code, function($q, $service_code) {
if ($service_code == 'IP'){ // Penjagaan sementara agar ini hanya muncul di inpatient monitoring