I have a few blade template files which I want to include in my view dynamically based on the permissions of current user stored in session. Below is the code I've written:
@foreach (Config::get('constants.tiles') as $tile)
@if (Session::get('currentUser')->get('permissions')[$tile]['read'] == 1)
@include('dashboard.tiles.' . $tile)
@endif
@endforeach
Blade is not allowing me to concatenate the constant string with the value of variable $tile. But I want to achieve this functionality. Any help on this would be highly appreciated.
[{$tile}]
- does that fix it? – Wrac