Following the documentation, I have created my own mail template using markdown mailables: https://laravel.com/docs/9.x/mail#generating-markdown-mailables
The point is that I need to customize information in both the header and footer dynamically (in each situation it will be different). The information I pass in the toMail function is only available in the scope of my custom template neworder.blade.php:
public function toMail($notifiable){
$from = 'no-reply.'.$this->subdomain.'@'.env('APP_DOMAIN');
return (new MailMessage)
->from($from)
->markdown('emails.neworder',
[
'name'=>$this->name,
'order'=> $this->order,
'emailbody'=> $this->emailbody,
'headertitle' => $this->headertitle,
'footertext' => $this->footertext
]
);
}
Following the same documentation, I have exported the Markdown mail components to customize them with this command:
php artisan vendor:publish --tag=laravel-mail
From here I can customize files like /vendor/mail/html/themes/header.blade.php, where the modifications effectively affect the header. What I can't figure out is how to pass variables that I can use in the scope of these files just like in /views/email/neworder.blade.php
I need to have the values of headertitle and footertext in the corresponding sections.