Skip to content
Advertisement

How to pass variables into Blade using Laravel’s Mail functions?

I have this class that takes care of emails.

JavaScript

the $massage parameter is called from the a this class,

JavaScript

Now i want to display the message the message in the emails.notification.blade and i tried this way

JavaScript

this is the exception that I got. anyone with a better suggestion?

Advertisement

Answer

In your controller, the variables are passed as an associative array to Mail::send():

JavaScript

and in your Blade template, you can reference the variables by using {{$mailBody}} or {{$emailId}} .

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