penugasan = $penugasan; $this->status = $status; $this->action = $action; // 'disetujui', 'dihapus', 'ditolak' } /** * Get the notification's delivery channels. * * @return array */ public function via(object $notifiable): array { return ['database']; } /** * Get the array representation of the notification. * * @return array */ public function toDatabase(object $notifiable): array { $kegiatan = $this->penugasan->kegiatan ?? 'Kegiatan Anda'; if ($this->action === 'dihapus') { $message = "Laporan kegiatan '{$kegiatan}' telah Dihapus oleh Admin."; } elseif ($this->action === 'disetujui') { $message = "Hore! Laporan kegiatan '{$kegiatan}' telah Disetujui (Selesai)."; } elseif ($this->action === 'ditolak') { $message = "Maaf, Laporan kegiatan '{$kegiatan}' Ditolak. Silakan periksa kembali."; } else { $message = "Status laporan kegiatan '{$kegiatan}' diubah menjadi: {$this->status}."; } return [ 'penugasan_id' => $this->penugasan->id ?? null, 'status' => $this->status, 'action' => $this->action, 'message' => $message, 'kegiatan' => $kegiatan ]; } }