I have category table with is_featured column. now I want o select featured categories with 3 product (limit 3 or every featured category). I tried with following code but getting only 3 product from first featured category.
$categories = Category::where('is_featured', true)->with('products', function ($query){
$query->take(3);
})->get();
Can anyone help me to figure out this? Thanks in Advance