Answers for "share var in a maser layout laravel"

PHP
0

share var in a maser layout laravel

View::composer('layouts.main', function($view)
{
    $view->with('name', Auth::check() ? Auth::user()->firstname : '');
});
Posted by: Guest on September-27-2021
0

share var in a maser layout laravel

View::composer('*', function($view)
{
    $view->with('name', Auth::check() ? Auth::user()->firstname : '');
});
Posted by: Guest on September-27-2021
0

share var in a maser layout laravel

View::share('name', Auth::user()->firstname);
Posted by: Guest on September-27-2021
0

share var in a maser layout laravel

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:
Posted by: Guest on September-27-2021

Browse Popular Code Answers by Language