How can I render Blade templates from the database (instead of using a blade template file)?
I've checked this Render template from blade template in database but for some reason is not replacing the variables in the template. It's giving a Notice: Undefined Variable.
Any ideas?
Thanks in advance
For these, who stumble across this just now: In Laravel 9, it's implemented natively.
https://laravel.com/docs/9.x/blade#rendering-inline-blade-templates
use Illuminate\Support\Facades\Blade;
return Blade::render('Hello, {{ $name }}', ['name' => 'Julian Bashir']);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With