fix export arrival list

This commit is contained in:
omair saleh
2022-05-11 13:42:26 +08:00
parent d972e98732
commit 2e03ce370d
@@ -41,7 +41,9 @@ class ExportsArrivedParcel implements WithHeadings, WithHeadingRow, WithMapping,
{
$returnArray = collect();
$packingLists = PackingList::where('type', '=', 1)->where('status', '=', 2)->where('owner_type', '!=', CompanyModule::class)->get();
$packingLists = PackingList::where('type', '=', 1)->where('status', '=', 2)->where('owner_type', '!=', CompanyModule::class)->whereHas('transports', function ($query){
return $query->whereYear('drop_date', 2022);
})->get();
foreach($packingLists as $packingList){
$packages = !$packingList->packingLists()->exists() ? $packingList->packages : $packingList->packingLists->first()->packages;