order = $order; } /** * Get the notification's delivery channels. * * @return array */ public function via(): array { return ['mail']; } /** * Get the mail representation of the notification. * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail(): \Illuminate\Notifications\Messages\MailMessage { return (new MailMessage()) ->template('notifications::email-club') ->subject(trans('Récapitulation de votre commande - :site_name', [ 'site_name' => config('app.name') ])) ->greeting(trans('Bonjour :name,', ['name' => $this->order->firstname])) ->line(trans("Merci pour votre achat !")) ->line(trans("Votre commande a bien été prise en compte et sera traitée sous les meilleurs délais.")) ->line(trans("Vous pouvez retrouver le récapitulatif de votre commande :strong en pièce jointe. :endStrong", [ 'strong' => '', 'endStrong' => '' ] )) ->lineIf( $this->order->payementType->equals(OrderType::check), trans("Si vous avez choisi un paiement par chèque : Merci de nous faire parvenir votre chèque à l'ordre de LDC et à l'adresse suivante :") ) ->lineIf( $this->order->payementType->equals(OrderType::check), trans(":strong LDC - Boutique Club Le Gaulois :br ZI Saint-Laurent - CS 50925 :br 72300 Sablé sur Sarthe :endStrong", [ 'strong' => '', 'endStrong' => '', 'br' => '
' ] )) ->lineIf( $this->order->payementType->equals(OrderType::check), trans("Une fois le chèque reçu, vous recevrez votre fond de carte de France sous un délai maximum de 5 semaines.") ) ->lineIf( $this->order->payementType->equals(OrderType::check), trans("Attention, vous disposez de 30 jours maximum pour envoyer votre chèque. Au delà des 30 jours, votre commande sera automatiquement annulée.") ) ->attachData($this->makePdfFile(), 'recapitulatif_commande_le_gaulois.pdf'); } /** * Create the recap of the order. * * @return string */ private function makePdfFile(): string { return LaravelMpdf::loadHTML( view('club.pages.shop.template-pdf-order', $this->order->exportToOrderMailData())->render(), [ 'mode' => '', 'format' => 'A4', 'default_font_size' => '12', 'default_font' => 'sans-serif', 'margin_left' => 0, 'margin_right' => 0, 'margin_top' => 0, 'margin_bottom' => 0, 'margin_header' => 0, 'margin_footer' => 0, 'orientation' => 'P', 'title' => trans('Commande Le Gaulois'), 'author' => 'Le Gaulois', 'watermark' => '', 'show_watermark' => false, 'show_watermark_image' => false, 'display_mode' => 'fullpage', 'watermark_font' => 'sans-serif', 'watermark_text_alpha' => 0.1, 'watermark_image_path' => '', 'watermark_image_alpha' => 0.2, 'watermark_image_size' => 'D', 'watermark_image_position' => 'P', 'custom_font_dir' => base_path('resources/assets/fonts/'), 'custom_font_data' => [ 'bouton-base' => [ 'R' => 'BourtonBase.ttf' ] ], 'auto_language_detection' => false, 'temp_dir' => storage_path('app'), 'pdfa' => false, 'pdfaauto' => false, 'use_active_forms' => false, ] )->output(); } }