Merge remote-tracking branch 'origin/staging' into origin/production

This commit is contained in:
Server D3 Linksehat
2024-10-16 10:33:14 +07:00
6 changed files with 130 additions and 33 deletions

View File

@@ -72,6 +72,23 @@ class RequestLogController extends Controller
$q->orderBy($orderBy, $request->order);
}
})
->when($request->file, function ($q, $search) {
if ($search == 'kondisi') {
$q->whereHas('files', function ($subQuery) {
$subQuery->where('type', 'final-log-kondisi');
});
} elseif ($search == 'diagnosa') {
$q->whereHas('files', function ($subQuery) {
$subQuery->where('type', 'final-log-diagnosis');
});
} elseif ($search == 'result') {
$q->whereHas('files', function ($subQuery) {
$subQuery->where('type', 'final-log-result');
});
} elseif ($search == 'none') {
$q->doesntHave('files');
}
})
->when(empty($request->orderBy), function ($q) {
$q->orderBy('submission_date', 'desc');
})