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,