It should work the way it its, but... If you need to spread something to more than one view, you better use View::composer()
or View::share()
:
View::share('name', Auth::user()->firstname);
If you need it only on your layout.main, you can:
View::composer('layouts.main', function($view)
{
$view->with('name', Auth::check() ? Auth::user()->firstname : '');
});
If you need it on all your views you can:
View::composer('*', function($view)
{
$view->with('name', Auth::check() ? Auth::user()->firstname : '');
});
You can even create a file for this purpose, something like app/composers.php
and load it in your app/start/global.php
:
require app_path().'/composers.php';