notifiable = $model; } /** * Get the notification's delivery channels. * * @return array * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function via() { return ['mail']; } /** * Build the mail representation of the notification. * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail() { /** @var string $subject */ $subject = $this->notifiable->subject; /** @var string $firstname */ $firstname = $this->notifiable->firstname; /** @var string $lastname */ $lastname = $this->notifiable->lastname; /** @var string $email */ $email = $this->notifiable->email; /** @var string $email */ $email = $this->notifiable->email; /** @var string $orderNumber */ $orderNumber = $this->notifiable->order_number; /** @var string $message */ $message = $this->notifiable->message; /** @var string $file */ $file = $this->notifiable->file; $notification = (new MailMessage()) ->subject(trans("Contact - :siteName - " . $subject, [ 'siteName' => config('theme.site_name') ])) ->line(trans("Voici un message envoyé depuis :siteName :", [ 'siteName' => config('theme.site_name') ])) ->line(trans("Expéditeur : :firstname :lastname", [ 'firstname' => $firstname, 'lastname' => $lastname ])) ->line(trans("Email : :email", ['email' => $email])); ($orderNumber) ? $notification->line(trans("Référence commande : :num", [ 'num' => $orderNumber ?? 'non saisie' ])) : $notification; $notification->line($message); return ($file) ? $notification->attach($file) : $notification; } }