I have a pagebuilder where i store {variable} in the database. When loaded on the frontend i want the variable to be translated to blade components.
$replacers = [
'x-system-counters' => '<x-system-counters :data="$gloabal_variable"></x-system-counters>',
'x-system-status' => '<x-system-status :data="$gloabal_variable"></x-system-status>',
];
$page = \App\Page::first();
$text = $page->content;
foreach ($replacers as $key => $value) {
$text = str_replace('{'.$key.'}', $value, $text);
}
//Bladefile
{!! $text !!}
Any idea of how to solve this? I have tried the Blade::compileString($text) with no luck.
Thanks