CarlEOgden
6 months ago
918
2
Laravel

Displaying HTML text from a variable in a blade

Posted 6 months ago by CarlEOgden

Hi All

Hope everyone is okay and staying safe!

I've got a daily php cron routine that I'm writing, I've got all the data in my controller and when I then call the blade to create the view that will be emailled, I can't get v-html to display the variable as its coming from a php variable and not a javascript variable.

To call my blade I use:-

\Mail::send('emails.ml-email', compact('subject', 'email', 'email_body', 'agent', 'send_as_email'), function ($message) use ($email, $subject) 

In my blade, i've tried:

{{ $email_body }}

<div v-html="{{ $email_body }}"

but I either get:

<div>Email test</div>

or nothing or just the variable name!

Can anyone help me simply display the text held within $email_body a formatted html.

Thanks in advance for any and all help given Carl.

Please sign in or create an account to participate in this conversation.