conversation = $conversation; } /** * Get the notification's delivery channels. * * @return array */ public function via(object $notifiable): array { $channels = []; $prefs = $notifiable->preferences ?? []; if ($prefs['notifications_email'] ?? true) { $channels[] = 'mail'; } if ($prefs['notifications_system'] ?? true) { $channels[] = 'database'; } return $channels; } /** * Get the mail representation of the notification. */ public function toMail(object $notifiable): MailMessage { return (new MailMessage) ->subject('Nova Conversa do Chatbot - ' . config('app.name')) ->greeting('Olá, ' . $notifiable->name) ->line('Um visitante iniciou uma conversa no chatbot do site.') ->line('**Nome:** ' . ($this->conversation->visitor_name ?? 'Não informado')) ->line('**Telefone:** ' . ($this->conversation->visitor_phone ?? 'Não informado')) ->line('**Cidade:** ' . ($this->conversation->visitor_city ?? 'Não informado')) ->action('Ver Conversa', route('admin.chatbot.conversation.show', $this->conversation->id)) ->line('Acesse o painel para ver o histórico completo da conversa.'); } /** * Get the array representation of the notification. * * @return array */ public function toArray(object $notifiable): array { return [ 'conversation_id' => $this->conversation->id, 'name' => $this->conversation->visitor_name ?? 'Visitante', 'email' => $this->conversation->visitor_phone ?? '', 'message' => 'Nova conversa no chatbot: ' . ($this->conversation->visitor_name ?? 'Visitante') . ' de ' . ($this->conversation->visitor_city ?? '?'), 'link' => route('admin.chatbot.conversation.show', $this->conversation->id) ]; } }