imamhsn195
6 months ago

How Can I get chunked value from nested eloquent collection

Posted 6 months ago by imamhsn195
$brands = Brand::with(['products.pricePolicy' => function($query){
    $query->where('status',1);
        }])
->with('products.images')->whereHas('products')->get();

        //$brands = $brands[0]->products->chunk(2);

I need to get all products with chunked under each brand. How can I do this? #chunk

Please sign in or create an account to participate in this conversation.