From 7bde77036d5d3e11ad3d3726f6146c7bf09c4416 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 1 Oct 2021 19:34:25 +0800 Subject: [PATCH] customer report --- routes/web.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/routes/web.php b/routes/web.php index 29757f4b..7152d940 100644 --- a/routes/web.php +++ b/routes/web.php @@ -133,7 +133,7 @@ Route::get('/report', function(){ $containers = Container::whereMonth('loading_date', '=', '09')->whereYear('loading_date', '=', '2021')->get(); $total = 0; - $customers = []; + $customers = collect(); foreach ($containers as $container){ foreach($container->packingLists as $packingList){ @@ -142,13 +142,13 @@ Route::get('/report', function(){ }); $total += $cbm; - if(!array_key_exists($packingList->owner->id, $customers)){ + if(!$customers->has($packingList->owner->id)){ $marking = $packingList->owner->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference; - $customers[$packingList->owner->id] = [ + $customers->put($packingList->owner->id, collect([ 'marking' => $marking, 'cbm' => $cbm, 'packages' => $packingList->packages->sum('quantity') - ]; + ])); continue; }