From ba45d0b272f7fb25ee236e4709c514a432d1e41d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 25 Jul 2021 09:11:28 +1000 Subject: [PATCH] Checks for contact id --- app/Traits/GenerateMigrationResources.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Traits/GenerateMigrationResources.php b/app/Traits/GenerateMigrationResources.php index 08e01bfe6667..1d25e554bcb3 100644 --- a/app/Traits/GenerateMigrationResources.php +++ b/app/Traits/GenerateMigrationResources.php @@ -443,6 +443,10 @@ trait GenerateMigrationResources foreach($agts as $agt) { $payment_method = $agt->default_payment_method; + + if(!$payment_method) + continue; + $contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first(); $transformed[] = [ @@ -1631,6 +1635,9 @@ trait GenerateMigrationResources $contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first(); $agt = AccountGatewayToken::where('id', $payment_method->account_gateway_token_id)->withTrashed()->first(); + if(!$contact && !$agt) + continue; + $transformed[] = [ 'id' => $payment_method->id, 'company_id' => $this->account->id,