$array = Products::where('categorie', '=', $cato->id)->get();
$count3 = Products::where('categorie', '=', $cato->id)->count();
$dropdowns = Categories::where('head_id', '=', $cato->id)->get();
foreach ($dropdowns as $dropdown) {
$count3 = $count3 + Products::where('categorie', '=', $dropdown->id)->count();
$products2 = Products::where('categorie', '=', $dropdown->id)->get();
$array = array_merge($array->toArray(), $products2->toArray());
}
$page = Input::get('page', 1);
$total_products = count($array);
$total_pages = ceil($total_products / 9);
if ($page > $total_pages or $page < 1) {
$page = 1;
}
$offset = ($page * 9) - 9;
$array = array_slice($array, $offset, 9);
$products = Paginator::make($array, $total_products, 9);