Group 2d Laravel collection by two columns and sum a third column within each group
I have this collection: $stocks = collect( [ ['sku' => '123', 'batch' => '123', 'qty_total' => 1], ['sku' => '1233', 'batch' => '123', 'qty_total' => 2], ['sku' => '123', 'batch' => '123', 'qty_total' => 3], ['sku' => '5', 'batch' =>…