group container packing lists by customer

This commit is contained in:
omair saleh
2022-03-05 16:38:12 +08:00
parent 5fab8224c6
commit 686ef83f31
+1 -1
View File
@@ -30,7 +30,7 @@ class ContainerResource extends JsonResource
'remarks' => RemarkResource::collection($this->remarks),
'status' => $this->status,
'packing_lists' => $this->whenLoaded('packingLists', PackingListResource::collection($this->whenLoaded('packingLists', function(){
return $this->packingLists()->whereHas('packages')->get()->groupBy(function ($packingList) {
return $this->packingLists()->whereHas('packages')->get()->sortBy(function ($packingList) {
return $packingList->owner->company_module_id;
});
})))