i have a query that i want to take some certain amount of object from each category for example 4 from category 1 and 4 from category 2 and here is what i wrote :
$wish = DB::table('table')
->where('category_id', $category)
->whereIn('type_id',[2,4])
->take(8)->get();
so here i want to say to take 4 from type_id 2 and get another 4 from type_id 4 . is there any way to do that or any package to do that in caravel eloquent ??