contact = $contact; } /** * Get the notification's delivery channels. * * @return array */ public function via(object $notifiable): array { $channels = []; // Verifica as preferências do usuário (notifiable) $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('Novo Contato Recebido - ' . config('app.name')) ->greeting('Olá, ' . $notifiable->name) ->line('Você recebeu uma nova mensagem de contato através do site.') ->line('**Nome:** ' . $this->contact->name) ->line('**E-mail:** ' . $this->contact->email) ->line('**Mensagem:**') ->line($this->contact->message) ->action('Visualizar no Painel', route('admin.contacts.show', $this->contact->id)) ->line('Obrigado por usar nosso sistema!'); } /** * Get the array representation of the notification. * * @return array */ public function toArray(object $notifiable): array { return [ 'contact_id' => $this->contact->id, 'name' => $this->contact->name, 'email' => $this->contact->email, 'message' => 'Nova mensagem de contato recebida.', 'link' => route('admin.contacts.show', $this->contact->id) ]; } }