bugs fix search dan daily monitoring

This commit is contained in:
Linksehat Staging Server
2024-02-19 08:50:22 +07:00
parent 785f20e235
commit cf85af68fe
2 changed files with 10 additions and 7 deletions

View File

@@ -57,9 +57,11 @@ class RequestLogController extends Controller
$q->where('final_log', $final_log);
})
->when($request->search, function ($q, $search) {
$q->where('code', 'LIKE', "%".$search."%");
$q->orWhereHas('member', function ($subQuery) use ($search) {
$subQuery->where('name', 'LIKE', "%".$search."%");
$q->where(function ($subQuery) use ($search) {
$subQuery->where('code', 'LIKE', "%".$search."%")
->orWhereHas('member', function ($subSubQuery) use ($search) {
$subSubQuery->where('name', 'LIKE', "%".$search."%");
});
});
})
->when($request->orderBy, function ($q, $orderBy) use ($request) {
@@ -424,7 +426,7 @@ class RequestLogController extends Controller
// if($requestLog->service_code != 'IP'){
// $requestLog->discharge_date = Carbon::now();
// }
$requestLog->save();
@@ -921,7 +923,7 @@ class RequestLogController extends Controller
// Menghapus file dari penyimpanan
if (Storage::exists($path)) {
Storage::delete($path);
// Update entri file dari basis data
File::where('path', $request->path)->update([
'deleted_at' => Carbon::now(), // Gunakan Carbon untuk mendapatkan tanggal dan waktu saat ini