Checks for contact id

This commit is contained in:
David Bomba 2021-07-25 09:11:28 +10:00
parent 3671bcced5
commit ba45d0b272

View File

@ -443,6 +443,10 @@ trait GenerateMigrationResources
foreach($agts as $agt) { foreach($agts as $agt) {
$payment_method = $agt->default_payment_method; $payment_method = $agt->default_payment_method;
if(!$payment_method)
continue;
$contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first(); $contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first();
$transformed[] = [ $transformed[] = [
@ -1631,6 +1635,9 @@ trait GenerateMigrationResources
$contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first(); $contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first();
$agt = AccountGatewayToken::where('id', $payment_method->account_gateway_token_id)->withTrashed()->first(); $agt = AccountGatewayToken::where('id', $payment_method->account_gateway_token_id)->withTrashed()->first();
if(!$contact && !$agt)
continue;
$transformed[] = [ $transformed[] = [
'id' => $payment_method->id, 'id' => $payment_method->id,
'company_id' => $this->account->id, 'company_id' => $this->account->id,