diff --git a/routes/web.php b/routes/web.php index 501ec216..d5a53e8a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -143,8 +143,9 @@ Route::get('/report', function(){ $total += $cbm; $marking = $packingList->owner->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference; - if(!$customers->has($marking)){ + if(!$customers->has($packingList->owner->id)){ $customers->put($marking, collect([ + 'marking' => $marking, 'cbm' => $cbm, 'packages' => $packingList->packages->sum('quantity') ])); @@ -152,8 +153,8 @@ Route::get('/report', function(){ continue; } - $customers[$packingList->owner->id]['cbm'] += $cbm; - $customers[$packingList->owner->id]['packages'] += $packingList->packages->sum('quantity'); + $customers[$marking]['cbm'] += $cbm; + $customers[$marking]['packages'] += $packingList->packages->sum('quantity'); } }