Reputation: 39
{{$one = 'testFileName'}}
@include('folder.project.$one')
Upvotes: 2
Views: 560
Reputation: 687
First define variable in PHP tag (not {{ }})
@php($one = 'testFileName')
Second Use variable :
@include('folder.project'.$one)
Upvotes: 1
Reputation: 8618
You can do that
First solution
{{$one = 'folder.project.testFileName'}}
@include($one)
second solution
{{$one = 'testFileName'}}
@include("folder.project.$one")
third solution
{{$one = 'testFileName'}}
@include("folder.project." . $one)
And for define variable you can also use
@php
$one = 'testFileName';
@endphp
or (but it can depends of laravel version)
@php($one = 'testFileName')
Upvotes: 5