*/ public function via(object $notifiable): array { return ['mail']; } public function toMail(object $notifiable): MailMessage { $template = NotificationTemplate::findByIdentifier('contact_new_request'); $vars = [ 'contact_name' => $this->contact->full_name, 'contact_email' => $this->contact->email ?? '', 'contact_subject' => $this->contact->subject ?? '', 'contact_message' => $this->contact->message ?? '', 'app_name' => config('app.name'), ]; return (new MailMessage) ->subject($template->renderSubject($vars)) ->view('notifications.mail-template', [ 'body' => $template->renderBody($vars), ]); } /** * @return array */ public function toArray(object $notifiable): array { return []; } }