Skip to content

Commit

Permalink
Merge pull request #8 from bakaphp/refact-contact-update
Browse files Browse the repository at this point in the history
  • Loading branch information
kaioken authored Nov 29, 2021
2 parents 816b8a2 + 3375d63 commit 3fbcb69
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Leads/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,13 @@ public function update(Dealer $dealer, User $user) : self
}

if (!empty($this->phones) && isset($data['ContactInformation']['Phones'])) {
$data['ContactInformation']['Phones'][0]['Number'] = Str::limit(
preg_replace('/[^0-9]/', '', $data['ContactInformation']['Phones'][0]['Number']),
10,
''
);
if (isset($data['ContactInformation']['Phones'][0])) {
$data['ContactInformation']['Phones'][0]['Number'] = Str::limit(
preg_replace('/[^0-9]/', '', $data['ContactInformation']['Phones'][0]['Number']),
10,
''
);
}
}

$response = $client->put('/gateway/v1/contact/' . $this->id, json_encode($data));
Expand Down

0 comments on commit 3fbcb69

Please sign in to comment.