Just done a fresh install of L5 and, as per the documentation, i'm trying to share data with all views using a simple share method in the AppServiceProvider class.
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use View;
class AppServiceProvider extends ServiceProvider {
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
View::share('website', 'test');
}
/**
* Register any application services.
*
* This service provider is a great spot to register your various container
* bindings with the application. As you can see, we are registering our
* "Registrar" implementation here. You can add your own bindings too!
*
* @return void
*/
public function register()
{
$this->app->bind(
'Illuminate\Contracts\Auth\Registrar',
'App\Services\Registrar'
);
}
}
route file:
Route::get('/', function(){
return view('test');
});
blade file:
<h1>Test</h1>
{{ $website }}
This should be really easy, so i'm wondering if i've made a very obvious mistake at the installation stage.
Thanks