import bank record

This commit is contained in:
Omair Saleh
2023-03-13 01:21:39 +08:00
parent 1cbf1a987f
commit 72e51ee2c5
@@ -39,24 +39,24 @@ class ImportsBankRecord implements ToModel, WithHeadingRow, WithBatchInserts, Wi
'payments' => $transaction->pluck('owner.marking')
]);
try {
preg_match_all('/([0-9]{3,4}[a-zA-Z]{3,4})/', $row['desc2'], $matches);
foreach ($matches[0] as $match){
$reference = $match;
$debtor = $row['code'];
$company = Company::where('reference', $reference)->whereNull('debtor')->first();
if ($company) {
$company->debtor = $debtor;
$company->update();
}
}
} catch (\Exception $exception){
dd($exception);
}
// try {
// preg_match_all('/([0-9]{3,4}[a-zA-Z]{3,4})/', $row['desc2'], $matches);
//
// foreach ($matches[0] as $match){
// $reference = $match;
// $debtor = $row['code'];
// $company = Company::where('reference', $reference)->whereNull('debtor')->first();
//
// if ($company) {
// $company->debtor = $debtor;
// $company->update();
// }
//
// }
//
// } catch (\Exception $exception){
// dd($exception);
// }
}
public function batchSize(): int