I have unusual situation which I have to print dynamic variables inside another variable in blade but not sure if it's possible or how to?
Example
// this returns content of my template which has dynamic data in it
{!! $data['template']->content !!}
// inside that template content I have to get user name like
{{$data['customer']->name}}
the problem is printing customer name
here is sample result
Note:
$data['customer']is provided in view page but the problem is how to get it inside my template data.
Code
My code is basically is just sample code i shared above (it's all happening in blade)
{!! $data['template']->content!!}
// inside `content` there is like:
<h4>{{$data['customer']->customer_lastname}}</h4>
Question
How can I get {{$data['customer']}} printed inside {!! $data['template']->content!!}?


file_get_contentsprobably i don't know how to use your referred link, would you mind share an answer?$data['customer']is already stored in the template content string. Laravel will treat it as a string. If you want to print such variables you would need to resolve to using low level functions likeeval. But if you are open to changing your methods, you could treat the content string before sending to blade; use pattern matching to replace predefined patterns.$data['customer']should behave as dynamic data which changes based on users.