Use variável em todas as páginas do site Laravel
{{Session::get('website_name', 'Value Goes Here')}}
SAMER SAEID
{{Session::get('website_name', 'Value Goes Here')}}
php artisan make:middleware SomeMiddleware
Config::get('app.name')
# app/Providers/AppServiceProvider.php
public function boot()
{
// add this
view()->share('someKey', 'This is shared data');
}
View::composer('*', function($view)
{
$view->with('website_name', 'My website');
});
public function handle($request, Closure $next)
{
if (!Session::has('website_name')) {
// some logic
Session::put('website_name', 'YOUR VALUE');
}
return $next($request);
}