Skip to content

Injecting data With Blade

// categoriesCount.blade.php
@inject('categories','App\categories')

Total categories : {{ $categories->count(); }}

or

// routes.php
view::composer('categories',function($view){ 
  $view->with('categories','App\categories');
});

// categoriesCount.blade.php

Total categories : {{ $categories->count(); }}

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments