bugs fix ambil path di list provider

This commit is contained in:
Server D3 Linksehat
2025-08-27 16:30:44 +07:00
parent 9900c00b8d
commit a9423e8b0a
6 changed files with 279 additions and 39 deletions

View File

@@ -990,9 +990,31 @@ class RequestLogController extends Controller
$documents = DB::table('files')
->where('fileable_type', 'App\Models\RequestLog')
->where('fileable_id', $claimRequestId)
->select('original_name', \DB::raw("CONCAT('" . env('APP_URL') . "/storage/', path) as path"), 'type')
->select('original_name', 'path', 'source','type')
->orderBy('id', 'desc')
->get();
->get()
->map(function ($row) {
// default null kalau tidak ada path
if (!$row->path) {
$row->path = null; // atau bisa $row->url = null
return $row;
}
if ($row->source === 's3') {
try {
$row->path = Storage::disk('s3')->temporaryUrl(
$row->path,
now()->addMinutes(60)
);
} catch (\Exception $e) {
$row->path = Storage::disk('s3')->url($row->path);
}
} else {
$row->path = Storage::disk('public')->url($row->path);
}
return $row;
});
$results['documents'] = $documents;
$dialog_submits = DB::table('claim_requests')
->leftJoin('members', 'claim_requests.member_id','=', 'members.id')