public function __construct()
 {
     view::composer('partials.nav', function ($view) {
         $categories = Category::all();
         $view->with(compact('categories'));
     });
 }
示例#2
0
 public function __construct()
 {
     // injecter du code dans la vue 'partials.categories' : ($view -> template)
     view::composer('partials.categories', function ($view) {
         $view->with('categories', Category::all());
     });
     view::composer('partials.tags', function ($view) {
         $view->with('tags', Tag::all());
     });
 }
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     view::composer(['vistas.index', 'vistas.article'], 'App\\Http\\ViewComposers\\AsideComposer');
 }