@php $main_other_contact = $main_other_contact; $main_new_contact = $main_new_contact; $contact_to_addresses = $main_other_contact->contacts_to_addresses; $main_other_contacts_relations = $main_other_contact->new_contacts_relations; $contactData = [ 'Title' => $main_other_contact->title, 'First Name' => $main_other_contact->first_name, 'Middle Name' => $main_other_contact->middle_name, 'Surname' => $main_other_contact->surname, 'Name' => $main_other_contact->name, 'Date of Birth' => $main_other_contact->date_of_birth ? Carbon\Carbon::parse($main_other_contact->date_of_birth)->format('Y-m-d') : null, 'Gender' => $main_other_contact->gender, 'Pronoun' => $main_other_contact->pronoun, 'Nationality' => $main_other_contact->nationality, 'Ethnicity' => $main_other_contact->ethnicity, 'Religion' => $main_other_contact->religion, 'Sexual Orientation' => $main_other_contact->sexual_orientation, 'Marital Status' => $main_other_contact->marital_status, 'Disability Status' => $main_other_contact->disability_status, 'Dietary Preferences' => $main_other_contact->dietary_preferences, 'Profession' => $main_other_contact->profession, 'Regulatory Body' => $main_other_contact->profession_regulatory_body, 'Professional Registration No' => $main_other_contact->professional_registration_no, 'Passport No' => $main_other_contact->passport_no, 'Driver’s License No' => $main_other_contact->driver_license_no, 'Patient ID No' => $main_other_contact->patient_identification_no, 'Personal Mobile No' => $main_other_contact->personal_mobile_no, 'Work Mobile No' => $main_other_contact->work_mobile_no, 'Home Telephone No' => $main_other_contact->home_telephone_no, 'Work Telephone No' => $main_other_contact->work_telephone_no, 'Fax No' => $main_other_contact->fax_no, 'Facebook' => $main_other_contact->facebook, 'Instagram' => $main_other_contact->instagram, 'Twitter' => $main_other_contact->twitter, 'LinkedIn' => $main_other_contact->linkedin, 'YouTube' => $main_other_contact->youtube, 'Home Address' => $main_other_contact->home_address, 'Work Address' => $main_other_contact->work_address, 'Temporary Address' => $main_other_contact->temporary_address, 'Billing Address' => $main_other_contact->billing_address, 'Shipping Address' => $main_other_contact->shipping_address, 'Alternate Address' => $main_other_contact->alternate_address, 'Work Emails' => $main_other_contact->work_emails ? json_decode($main_other_contact->work_emails, true) : [], 'Personal Emails' => $main_other_contact->personal_emails ? json_decode($main_other_contact->personal_emails, true) : [], 'Work Phones' => $main_other_contact->work_mobiles ? json_decode($main_other_contact->work_mobiles, true) : [], 'Personal Phones' => $main_other_contact->personal_mobiles ? json_decode($main_other_contact->personal_mobiles, true) : [], ]; @endphp
{{ $main_other_contact->name }}

Personal

@foreach ($contactData as $label => $value) @php $fieldId = Str::snake(strtolower($label)); $fieldName = Str::snake(strtolower($label)); // Convert the label to snake_case for direct property access $otherValue = $main_new_contact->$fieldName ?? null; // Direct property access $matchFound = isset($otherValue) && ($main_other_contact->$fieldName == $otherValue) && !empty($main_other_contact->$fieldName); // if($fieldId == 'name'){ // dd($matchFound,$otherValue,$main_other_contact->$fieldName); // } @endphp @if (!empty($value))
@if (is_array($value))
    @foreach ($value as $item)
  • {{ $item }}
  • @endforeach
@else

{{ $value }}

@endif @if ($matchFound) @endif
@endif @endforeach
@if (isset($main_other_contact->date_of_birth))

{{ Carbon\Carbon::parse($main_other_contact->date_of_birth)->format('Y-m-d') }}

@endif @if (isset($main_other_contact->nhs_no))

{{ $main_other_contact->nhs_no }}

@if ($main_other_contact->nhs_no === $main_new_contact->nhs_no) @endif
@endif @if (isset($main_other_contact->ethnicity))

{{ $main_other_contact->ethnicity }}

@if ($main_other_contact->ethnicity === $main_new_contact->ethnicity) @endif
@endif @if (isset($main_other_contact->sexual_orientation))

{{ $main_other_contact->sexual_orientation }}

@if ($main_other_contact->sexual_orientation === $main_new_contact->sexual_orientation) @endif
@endif @if (isset($main_other_contact->marital_status))

@if ($main_other_contact->marital_status == 'single') Single @elseif ($main_other_contact->marital_status == 'married') Married @elseif ($main_other_contact->marital_status == 'separated') Separated @elseif ($main_other_contact->marital_status == 'divorced') Divorced @endif

@if ($main_other_contact->marital_status === $main_new_contact->marital_status) @endif
@endif @if (isset($main_other_contact->gender))

@if ($main_other_contact->gender == 'male') Male @elseif ($main_other_contact->gender == 'female') Female @elseif ($main_other_contact->gender == 'other') Other @endif

@if ($main_other_contact->gender === $main_new_contact->gender) @endif
@endif @if (isset($main_other_contact->pronoun))

{{ $main_other_contact->pronoun }}

@if ($main_other_contact->pronoun === $main_new_contact->pronoun) @endif
@endif @if (isset($main_other_contact->religion))

{{ $main_other_contact->religion }}

@if ($main_other_contact->religion === $main_new_contact->religion) @endif
@endif @if (isset($main_other_contact->passport_no))

{{ $main_other_contact->passport_no }}

@if ($main_other_contact->passport_no === $main_new_contact->passport_no) @endif
@endif @if (isset($main_other_contact->driver_license_no))

{{ $main_other_contact->driver_license_no }}

@if ($main_other_contact->driver_license_no === $main_new_contact->driver_license_no) @endif
@endif @if (isset($main_other_contact->profession))

{{ $main_other_contact->profession }}

@if ($main_other_contact->profession === $main_new_contact->profession) @endif
@endif @if (isset($main_other_contact->registration_no))

{{ $main_other_contact->registration_no }}

@if ($main_other_contact->registration_no === $main_new_contact->registration_no) @endif
@endif @if (isset($main_other_contact->other))

{{ $main_other_contact->other }}

@if ($main_other_contact->other === $main_new_contact->other) @endif
@endif

Contact Info

@if (isset($main_other_contact->work_emails) && json_decode($main_other_contact->work_emails, true) != null && count(json_decode($main_other_contact->work_emails, true)) > 0)
@foreach (json_decode($main_other_contact->work_emails, true) as $work_email)

{{ $work_email }}

@endforeach
@endif @if (isset($main_other_contact->personal_emails) && json_decode($main_other_contact->personal_emails, true) != null && count(json_decode($main_other_contact->personal_emails, true)) > 0)
@foreach (json_decode($main_other_contact->personal_emails, true) as $personal_email)

{{ $personal_email }}

@endforeach
@endif @if (isset($main_other_contact->work_mobiles) && json_decode($main_other_contact->work_mobiles, true) != null && count(json_decode($main_other_contact->work_mobiles, true)) > 0)
@foreach (json_decode($main_other_contact->work_mobiles, true) as $work_mobile)
@endforeach
@endif @if (isset($main_other_contact->personal_mobiles) && json_decode($main_other_contact->personal_mobiles, true) != null && count(json_decode($main_other_contact->personal_mobiles, true)) > 0)
@foreach (json_decode($main_other_contact->personal_mobiles, true) as $personal_mobile)
@endforeach
@endif @if (isset($main_other_contact->home_telephones) && json_decode($main_other_contact->home_telephones, true) != null && count(json_decode($main_other_contact->home_telephones, true)) > 0)
@foreach (json_decode($main_other_contact->home_telephones, true) as $home_telephone)
@endforeach
@endif @if (isset($main_other_contact->work_telephones) && json_decode($main_other_contact->work_telephones, true) != null && count(json_decode($main_other_contact->work_telephones, true)) > 0)
@foreach (json_decode($main_other_contact->work_telephones, true) as $work_telephone)
@endforeach
@endif @if (isset($main_other_contact->facebook))
{{ $main_other_contact->facebook }}
@endif @if (isset($main_other_contact->instagram))
{{ $main_other_contact->instagram }}
@endif @if (isset($main_other_contact->twitter))
{{ $main_other_contact->twitter }}
@endif @if (isset($main_other_contact->other_link)) @endif

Address

@if (isset($contact_to_addresses) && count($contact_to_addresses) > 0) @foreach ($contact_to_addresses as $contact_to_address) @endforeach @endif

Associations

@if (isset($main_other_contacts_relations) && count($main_other_contacts_relations) > 0) @foreach ($main_other_contacts_relations as $index => $main_other_contacts_relation) @endforeach @endif