vendredi 30 septembre 2016

Laravel Blade Dyamic Interpolation of Data Sent to the Template

There is a situation in our application where we've provided clients with the ability to create their own email template, which we store in the database, but when it comes to emailing the template normally we'd just pass it down to blade with some data to fill in the blanks, but the content has blanks that needs to be interpolated as well.

Database Template from Database

$template = "<p>Welcome </p>..."

But this is coming down in the data to the blade template, so we're running a replace over all the template coming out of the database prior to sending it down to blade so blade gets:

Database Template Interpolated on Server

$template = "<p>Welcome Joe</p>..."

Is it possible to send down the $first_name and $template with the data and have the template interpolated as well as the content of the template so:

Blade Template - Multi/Dynamic Interpolation all in Blade Template Instead



Will result in:

<p>Welcome Joe</p>...

Without us doing the template interpolation separately on the server?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire