Friday, March 31, 2017

laravel mailables -> replace tokens after view rendered

following thing:

I read posts from a wordpress database. The idea is that the posts act as master.

E.g. we have a wordpress post with post content:

Hi XX_USERNAME_XX,

nice to meet you.

XX_LARAVEL_CONTENT_XX

thanks for your donation of XX_DONATION_AMOUNT_XX

bye

I now want to send a normal laravel mailable that when sending out, does the replacements. Now the thing is the views in laravel typically act as master.

in this case though, I want the wordpress post content to be the master, and insert the laravel view into the wordpress content (XX_LARAVEL_CONTENT_XX). And while doing that, replace additional tokens (XX_DONATION_AMOUNT_XX).

How can I do stuff, just before the laravel mailable is rendered? e.g. before the output of the mailable is passed to the mail service, i want to hook in my own filter, take the output from the mailable and put that output into the wordpress post. Is there something supporting this?



via Toskan

Advertisement