*/ public function via(object $notifiable): array { return ['database', 'mail']; } /** * Get the mail representation of the notification. */ public function toMail(object $notifiable): MailMessage { $commenterName = $this->comment->user->name; return (new MailMessage()) ->subject("New Comment on Ticket: {$this->ticket->ticket_id}") ->greeting('Hello,') ->line("{$commenterName} left a new comment on ticket {$this->ticket->ticket_id} regarding {$this->ticket->issue_category}.") ->line('Comment: "'.Str::limit($this->comment->message, 300).'"') ->action('View Discussion', route('tickets.index')) ->line('Thank you for using our application!'); } /** * Get the array representation of the notification. * * @return array */ public function toArray(object $notifiable): array { $commenterName = $this->comment->user->name; $appName = $this->ticket->connectedApp->name ?? 'General Inquiry'; return [ 'ticket_id' => $this->ticket->id, 'ticket_code' => $this->ticket->ticket_id, 'user_name' => $commenterName, 'issue_category' => $this->ticket->issue_category, 'app_name' => $appName, 'description' => Str::limit($this->ticket->description ?? '', 100), 'message' => "{$commenterName} commented on ticket {$this->ticket->ticket_id}.", ]; } }