Reputation: 10828
Is it possible to store the output of @include('view.name')
into a variable?
Something like this:
$var = @include('view.name')
{{$var}}
The reason I want to do that I want to pass @include('view.name')
into Blade::directive()
For example:
@blocksection([
'Title',
'<p>Descrption</p>,
@include('view.name'),
])
// HTML
@endblocksection
Upvotes: 0
Views: 98
Reputation: 1187
I don't know if this is possible, but I'd rather do it in the following way (a cleaner approach I think):
$var = view('view.name')->render()
return view('your template', ['var' => $var])
Upvotes: 2