You should probably take a look at this: https://github.com/Flynsarmy/laravel-db-blade-compiler
Haven't tried anything like that myself :)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi guys,
I'm planning to develop a multi tenancy application which allows users to modify their own templates. To do this, I will store users template in database and render it when needed.
My name is {{{$name}}}-- name.blade.php
View::make('name')->with('name','Ted');
Above is how we normally do.
My problem is, how to pass the Blade template and compile it with data. I do understand Blade have the function called compileString, but it only able to render the given template without data. Example:
$template = Template::get('make'); // custom class where get the template in database, in this case,
My name is {{{$name}}}is returned Blade::compileString($template); //where I can't pass name variable to compile.
Hope you guys can help me. Thanks :)
Please or to participate in this conversation.