E
E
Eugene2018-06-17 13:51:22
Laravel
Eugene, 2018-06-17 13:51:22

How to pass a parameter to a basic Mailable Markdown template?

Ask such a question.
When sending emails and generating a template via Mailable messages in Markdown format, how can I pass the value of the parameter to the base layouts template?
More:
I exported all the Markdown components of the mail to my own application in order to customize them (customize).
The base template contains static elements. But after some time, the ENG version of the project appeared, and it turns out that I need to pass a parameter to the base layouts template, which I exported to the application (/resources/views/vendor/mail/html/layout.blade.php).
If you simply pass data through the mailable class constructor, then the main template does not accept it.

public function build() {

        return $this->markdown('emails.orders.shipped')->subject($this->title)->with([
           'langCode'  => $this->langCode
        ]);
    }

The template: emails.orders.shipped sees the langCode variable, but the base template does not.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question