Mar 7, 2017
0
Level 2
how to share @php block across partials
lets say we have a var call routeName that we want to share across several views,
@php
$routeName = Route::currentRouteName();
@endphp
so maybe we make a partial vars.blade.php and include it in each view we want this var
@include('_partials.vars')
but unfortunately this doesnt work, and i keep getting Undefined variable: routeName.
i tried to use @set but nothing changed, so did anyone came across such scenario ?
Please or to participate in this conversation.