feedback = $feedback; $this->sender = $sender; } /** * Get the notification's delivery channels. */ public function via($notifiable): array { return ['database']; } /** * Get the array representation of the notification. */ public function toArray($notifiable): array { return [ 'feedback_id' => $this->feedback->id, 'sender_id' => $this->sender ? $this->sender->id : null, 'type' => 'feedback_submitted', 'message' => $this->getNotificationMessage(), 'feedback_title' => $this->feedback->title ?? 'Unknown', 'feedback_type' => $this->feedback->type ?? 'Unknown', 'feedback_priority' => $this->feedback->priority ?? 'normal', 'user_name' => $this->feedback->user ? $this->feedback->user->name : 'Anonymous', 'user_email' => $this->feedback->user ? $this->feedback->user->email : null, ]; } /** * Get notification message */ private function getNotificationMessage(): string { $userName = $this->feedback->user ? $this->feedback->user->name : 'Pengguna tanpa nama'; $feedbackTitle = $this->feedback->title ?? 'Unknown'; $feedbackType = $this->feedback->type ?? 'Unknown'; $feedbackPriority = $this->feedback->priority ?? 'normal'; $feedbackId = $this->feedback->id; return "Maklum balas baru telah diterima. ID: {$feedbackId}, Tajuk: {$feedbackTitle}, Jenis: {$feedbackType}, Keutamaan: {$feedbackPriority}, Pengguna: {$userName}"; } }