how to share @php block across partials

Posted 1 year ago by ctf0

lets say we have a var call routeName that we want to share across several views,

    $routeName = Route::currentRouteName();

so maybe we make a partial vars.blade.php and include it in each view we want this var


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 sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.