Posted by Arjun Arjun on Saturday 13th June 2015, 1 minute read

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

...
Arjun

I am Arjun from Hyderabad (India). I have been working as a software engineer from the last 7+ years, and it is my passion to learn new things and implement them as a practice. Aside from work, I like gardening and spending time with pets.