It's much better approach to store printf format string instead of anything for eval. So you could store the string like this:
$format = 'Hello, %s';
And then echo it:
{{ sprintf($format, $first_name) }}
Or, even better, to prepare string in controller and pass it to the view.
The issue is that I'd need to be able to specify what variable I want injected, from the content of the string. Looks like my only option is pre-processing the string from the controller before the view gets rendered.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.