title: Laravel 8 Notifications markdown email template
body: <p>I'm migrating over to the Laravel <a href="https://laravel.com/docs/8.x/notifications#introduction" rel="nofollow noreferrer">Notifications</a> because of the flexibility of having different channels. I'm migrating from the standard Laravel <a href="https://laravel.com/docs/8.x/mail" rel="nofollow noreferrer">Mail</a> functionality.</p>
  <p>With the existing functionality I have, I'm using custom markdown email templates and am returning them inside the <code>build</code> method of the individual mail classes that I've built, for instace...</p>
  <pre class="lang-php prettyprint-override"><code>/**
   * Build the message.
   *
   * @return $this
   */
  public function build()
  {
      $domain = isset($this-&gt;emailData[0]['domain']) ? $this-&gt;emailData[0]['domain'] : '';
      $domain = htmlspecialchars($domain);
  
      return $this-&gt;markdown('emails.domains.expiry')
                  -&gt;subject(isset($domain) &amp;&amp; !empty($domain) ? &quot;Domain Expiry Alert: $domain&quot; : 'Domain Expiry Alert');
  }
  </code></pre>
  <p>Doing it this way I can customise my various email templates.</p>
  <p>Unortuantly, I tried this approach for the <code>toMail</code> method of my notification class variant, and it doesn't seem like Laravel Notifications support markdown files?</p>
  <pre class="lang-php prettyprint-override"><code>/**
   * Get the mail representation of the notification.
   *
   * @param  mixed  $notifiable
   * @return \Illuminate\Notifications\Messages\MailMessage
   */
  public function toMail($notifiable)
  {
      $domain = isset($this-&gt;emailData[0]['domain']) ? $this-&gt;emailData[0]['domain'] : '';
      $domain = htmlspecialchars($domain);
  
      return $this-&gt;markdown('emails.domains.expiry')
                  -&gt;subject(isset($domain) &amp;&amp; !empty($domain) ? &quot;Domain Expiry Alert: $domain&quot; : 'Domain Expiry Alert');
  }
  </code></pre>
  <p>Instead, they're <strong>expecting</strong> the following...</p>
  <pre class="lang-php prettyprint-override"><code>/**
   * Get the mail representation of the notification.
   *
   * @param  mixed  $notifiable
   * @return \Illuminate\Notifications\Messages\MailMessage
   */
  public function toMail($notifiable)
  {
      return (new MailMessage)
                  -&gt;line('The introduction to the notification.')
                  -&gt;action('Notification Action', url('/'))
                  -&gt;line('Thank you for using our application!');
  }
  </code></pre>
  <p>There is a section for customising templates, but this is the generic template and doesn't provide me with individual templates that I can pass data to. For instance, I need to pass a <code>$emailData</code> array to my template.</p>
  <p>How can I get the <code>toMail</code> method to work with the Laravel Mail notification classes I've built?</p>