From 686ef83f3194a7c8649edcb40237a7628c55ba74 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sat, 5 Mar 2022 16:38:12 +0800 Subject: [PATCH] group container packing lists by customer --- app/Http/Resources/ContainerResource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Resources/ContainerResource.php b/app/Http/Resources/ContainerResource.php index e112e8d9..42cc5fbb 100644 --- a/app/Http/Resources/ContainerResource.php +++ b/app/Http/Resources/ContainerResource.php @@ -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; }); })))