Reputation: 8560
I have code :
$a = test
$string = 'test {{ $a }}';
I want to process string in $string variable as blade template. I know I can save this to temp view something like this:
$a = test
$string = 'test {{ $a }}';
file_put_contents('temp.blade.php', $string);
$processedString = View::make('temp', compact($a));
but I don't want to save temp file, I want something like :
$a = test
$string = 'test {{ $a }}';
$processedString = View::makeFromString($string, compact($a));
Any ideas ?
Upvotes: 1
Views: 1432
Reputation: 8560
No, by default laravel does not support this, but this package
https://github.com/TerrePorter/StringBladeCompiler
work like charm for me.
Upvotes: 1