You should not do this kind of calculations in your view, this is something your models should be doing, or, maybe, you controller. This is an example:
class Billing extends Controller {
public function show($id)
{
$billing = Billing::find($id);
return View::make('billing.show')->with('billing', $billing->getAllWithItems())
}
}
class Billing extends Eloquent {
public function getAllWithItems()
{
return DB::table('billing')
->select(DB::raw('COUNT(items.id) as item_count')))
->left_join('items', 'items.billing_id', '=', 'billing.id')
->group_by('items.id')
->get();
}
}