Поделиться VAR в макете Laravel
View::share('name', Auth::user()->firstname);
Zealous Zebra
View::share('name', Auth::user()->firstname);
View::composer('*', function($view)
{
$view->with('name', Auth::check() ? Auth::user()->firstname : '');
});
View::composer('layouts.main', function($view)
{
$view->with('name', Auth::check() ? Auth::user()->firstname : '');
});
require app_path().'/composers.php';
You can even create a file for this purpose, something like app/composers.php and load it in your app/start/global.php: