From f9d246b9f6c201a62b5c447b22b45fbb1b57efb3 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sun, 20 Mar 2022 14:27:48 +0800 Subject: [PATCH] update debtors import --- app/Classes/Modules/Exports/Services/ExportsNullDebtors.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php b/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php index 6661d1d1..544e52a4 100644 --- a/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php +++ b/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php @@ -60,7 +60,9 @@ class ExportsNullDebtors implements FromQuery, WithHeadings, WithHeadingRow, Wit */ public function query() { - return Company::where('debtor', '=', null)->where('business_type', BusinessType::IMPORTER)->where('status', ApprovalStatus::APPROVED)->whereHas('transactions', function($query){ + return Company::where(function($query){ + $query->whereNull('debtor')->orWhere('debtor', ''); + })->where('business_type', BusinessType::IMPORTER)->where('status', ApprovalStatus::APPROVED)->whereHas('transactions', function($query){ return $query->whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP])->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED, ApprovalStatus::PENDING_VERIFICATION]); }); }