files->mapToGroups(function($file) { return [Str::slug($file->type, '_') => $file]; }); $provider = Organization::where('id', $this->organization_id)->first(); $data = [ 'id' => $this->id, 'code' => $this->code, 'submission_date' => $this->created_at, // submsion_date diambil dari kolom created_at 'admission_date' => $this->submission_date, // admission_date diambil dari kolom submission 'submission_date_fgl' => $this->approved_final_log_at, 'member_name' => $this->member->name, 'status' => $this->status ?? 'unknown', 'provider' => $provider ? $provider->name : '-', 'status_final_log' => $this->status_final_log ?? 'unknown', 'service_name' => $this->service ? $this->service->name : '', 'payment_type' => $this->payment_type, 'payment_type_name' => $this->payment_type_name, 'files_by_type' => $filesGroupByType ]; return $data; } }