*/ public function via(object $notifiable): array { return ['database', 'mail']; } /** * Get the mail representation of the notification. */ public function toMail(object $notifiable): MailMessage { $statusLabel = TicketStatusEnum::tryFrom($this->ticket->status->name)?->label() ?? ucfirst($this->ticket->status->name); return (new MailMessage()) ->subject("SSO Support Ticket Status Changed: {$this->ticket->ticket_id}") ->greeting('Hello,') ->line("The status of your support ticket {$this->ticket->ticket_id} regarding {$this->ticket->issue_category} has been updated.") ->line("New Status: {$statusLabel}") ->action('View Ticket Details', 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 { $appName = $this->ticket->connectedApp->name ?? 'General Inquiry'; $statusLabel = TicketStatusEnum::tryFrom($this->ticket->status->name)?->label() ?? ucfirst($this->ticket->status->name); return [ 'ticket_id' => $this->ticket->id, 'ticket_code' => $this->ticket->ticket_id, 'user_name' => $this->ticket->user->name, 'issue_category' => $this->ticket->issue_category, 'app_name' => $appName, 'description' => Str::limit($this->ticket->description ?? '', 100), 'message' => "The status of your support ticket {$this->ticket->ticket_id} has been changed to {$statusLabel}.", ]; } }