mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
fix export arrival list
This commit is contained in:
@@ -40,16 +40,17 @@ class ExportsArrivedParcel implements WithHeadings, WithHeadingRow, WithMapping,
|
||||
{
|
||||
$returnArray = collect();
|
||||
|
||||
$packingLists = PackingList::where('type', '=', 1)->where('status', '=', 2)->get();
|
||||
$exceptionUsers = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]);
|
||||
$packingLists = PackingList::where('type', '=', 1)->where('status', '=', 2)->where('transport', function ($query){
|
||||
return $query->whereMonth('drop_date', '>', 3)->whereYear('drop_date', 2022);
|
||||
})->get();
|
||||
|
||||
foreach($packingLists as $packingList){
|
||||
$packages = !$packingList->packingLists()->exists() || $exceptionUsers ? $packingList->packages : $packingList->packingLists->first()->packages;
|
||||
$packages = !$packingList->packingLists()->exists() ? $packingList->packages : $packingList->packingLists->first()->packages;
|
||||
foreach ($packages as $package) {
|
||||
$returnArray->push($package);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user