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(); }}

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

DMCA.com Protection Status