Render template from blade template in database

Posted 4 years ago by humakaka

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


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 sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.