in app/Services/VCard/ImportVCard.php [907:952]
private function importSocialProfile(Contact $contact, VCard $entry): void
{
if (is_null($entry->socialProfile)) {
return;
}
foreach ($entry->socialProfile as $socialProfile) {
$type = $socialProfile['type'];
$contactFieldTypeId = null;
$data = null;
switch ((string) $type) {
case 'facebook':
$contactFieldTypeId = $this->getContactFieldTypeId('Facebook');
$data = str_replace('https://www.facebook.com/', '', $this->formatValue((string) $socialProfile));
break;
case 'twitter':
$contactFieldTypeId = $this->getContactFieldTypeId('Twitter');
$data = str_replace('https://twitter.com/', '', $this->formatValue((string) $socialProfile));
break;
case 'whatsapp':
$contactFieldTypeId = $this->getContactFieldTypeId('Whatsapp');
$data = str_replace('https://wa.me/', '', $this->formatValue((string) $socialProfile));
break;
case 'telegram':
$contactFieldTypeId = $this->getContactFieldTypeId('Telegram');
$data = str_replace('http://t.me/', '', $this->formatValue((string) $socialProfile));
break;
case 'linkedin':
$contactFieldTypeId = $this->getContactFieldTypeId('LinkedIn');
$data = str_replace('http://www.linkedin.com/in/', '', $this->formatValue((string) $socialProfile));
break;
default:
// Not supported
break;
}
if (! is_null($contactFieldTypeId) && ! is_null($data)) {
ContactField::firstOrCreate([
'account_id' => $contact->account_id,
'contact_id' => $contact->id,
'data' => $data,
'contact_field_type_id' => $contactFieldTypeId,
]);
}
}
}