use varable on all site pages laravel code example
Example 1: use varable on all site pages laravel
php artisan make:middleware SomeMiddleware
Example 2: use varable on all site pages laravel
{{Session::get('website_name', 'Value Goes Here')}}
Example 3: use varable on all site pages laravel
public function boot()
{
view()->share('someKey', 'This is shared data');
}
Example 4: use varable on all site pages laravel
Config::get('app.name')
Example 5: use varable on all site pages laravel
public function handle($request, Closure $next)
{
if (!Session::has('website_name')) {
Session::put('website_name', 'YOUR VALUE');
}
return $next($request);
}
Example 6: use varable on all site pages laravel
View::composer('*', function($view)
{
$view->with('website_name', 'My website');
});