Skip to content
Advertisement

How to pass variable to markdown? laravel mail

I am using MailMessage to send a mail message to mailtrap, and I pass a variable email.

My problem it doesn’t recognize the variable that I pass in the markdown. It returns an error below

FacadeIgnitionExceptionsViewException: Undefined variable: email (View: /var/www/resources/views/ema…

Someone knows what is the proper way of passing and getting the variable from-to markdown?


Here is my code

JavaScript

Here is my markdown look alike

JavaScript

Advertisement

Answer

I eventually got the solution, by using the compact, instead of an array. I changed this line below, and everything works normal.

JavaScript

credits to @sibongisenimsomis from laracasts

Apparently passing variables to Markdown from Notification class works, differently. I used compact on my solution, after struggle for about an hour cause I was referring to another example which was using with, on a Mailable class.

https://laracasts.com/discuss/channels/laravel/passe-some-variables-to-the-markdown-template-within-a-notification

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement