mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-23 06:24:21 +00:00
group container packing lists by customer
This commit is contained in:
@@ -30,7 +30,9 @@ 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();
|
||||
return $this->packingLists()->whereHas('packages')->get()->groupBy(function ($package) {
|
||||
return $package->packingList->owner->company_module_id;
|
||||
});
|
||||
})))
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user