@php function getBase64Image($path) { if (!$path) return null; if (strpos($path, 'http') === 0) { try { $ctx = stream_context_create(['http' => ['timeout' => 5]]); $data = @file_get_contents($path, false, $ctx); if ($data !== false) { $finfo = new finfo(FILEINFO_MIME_TYPE); $mime = $finfo->buffer($data); return 'data:' . $mime . ';base64,' . base64_encode($data); } } catch (\Exception $e) { return null; } } $pathsToCheck = [public_path('storage/' . $path), storage_path('app/public/' . $path), public_path($path)]; foreach ($pathsToCheck as $fullPath) { $fullPath = str_replace('\\', '/', $fullPath); if (file_exists($fullPath)) { $type = pathinfo($fullPath, PATHINFO_EXTENSION) ?: 'jpg'; try { $data = @file_get_contents($fullPath); if ($data !== false) return 'data:image/' . $type . ';base64,' . base64_encode($data); } catch (\Exception $e) { continue; } } } return null; } $heroImage = getBase64Image($listing->thumbnail); $contactAvatar = $contactPerson && $contactPerson->profile_photo_path ? getBase64Image($contactPerson->profile_photo_path) : null; $propertyUrl = url('/property/' . ($listing->slug ?? $listing->id)); $qrImage = getBase64Image("https://api.qrserver.com/v1/create-qr-code/?size=100x100&data=" . urlencode($propertyUrl)); $phone = $contactPerson->phone ?? $contactPerson->phone_number ?? ''; $roleLabel = 'Consultant'; if ($contactPerson) { if ($contactPerson->hasRole('landlord')) { $roleLabel = 'Landlord'; } elseif ($contactPerson->hasAnyRole(['agent', 'Agency'])) { $roleLabel = 'Consultant'; } } @endphp
@if($heroImage) @else
PREVIEW UNAVAILABLE
@endif
@if($contactAvatar)
@endif
{{ $contactPerson->name ?? 'Property Consultant' }}
{{ $roleLabel }}
@if($phone)
{{ $phone }}
@endif @if(isset($contactPerson) && $contactPerson->email)
{{ $contactPerson->email }}
@endif
@if($phone) @endif @if(isset($contactPerson) && $contactPerson->email) @endif

{{ $listing->property_title }}

{{ $listing->address }}

£{{ number_format($listing->price) }} {{ $listing->price_qualifier }}
Ref. Number
#{{ $listing->property_reference_number }}
Property Type
{{ $listing->propertyType->title ?? 'Residential' }}
Market Status
{{ strtoupper($listing->purpose) }}
@if($qrImage)
DIGITAL PORTAL
@endif
Essential Overview
Beds
{{ $listing->bedrooms ?? '—' }}
Baths
{{ $listing->bathrooms ?? '—' }}
Recep.
{{ $listing->reception_rooms ?? '—' }}
Size
@if($listing->area_size && is_numeric($listing->area_size)) {{ number_format((float) $listing->area_size) }}ft² @else {{ $listing->area_size ?? '—' }} @endif
Floor
{{ $listing->floor_level ?? '—' }}
About this Property
{!! $listing->description !!}
@if($listing->features->count() > 0 || $listing->amenities->count() > 0 || (isset($listing->key_features) && count((array)$listing->key_features) > 0))
Property Highlights
@foreach($listing->features as $feature) {{ $feature->title }} @endforeach @foreach($listing->amenities as $amenity) {{ $amenity->title }} @endforeach @if(isset($listing->key_features) && is_array($listing->key_features)) @foreach($listing->key_features as $k_feature) @if(!empty($k_feature)) {{ $k_feature }} @endif @endforeach @endif
@endif
Technical Specifications
Tenure {{ $listing->tenure ?? 'N/A' }}
Lease Yrs {{ $listing->unexpired_years ?? '—' }}
Service Charge {{ $listing->service_charge ?? '—' }}
Ground Rent {{ $listing->ground_rent ?? '—' }}
Tax Band {{ $listing->council_tax_band ?? '—' }}
Parking {{ $listing->parking_type ?? 'N/A' }}
Construction {{ $listing->construction_type ?? 'Standard' }}
Utilities & Infrastructure
Water {{ $listing->utilities_water ?? 'Ask Agent' }}
Electricity {{ $listing->utilities_electricity ?? 'Ask Agent' }}
Heating {{ $listing->heating_type ?? 'Ask Agent' }}
Broadband {{ $listing->broadband ?? 'Ask Agent' }}
Mobile {{ $listing->mobile_coverage ?? 'Ask Agent' }}
@if(count($gallery) > 1)
Visual Gallery
@php $galleryItems = array_slice($gallery, 0, 12); @endphp @foreach(array_chunk($galleryItems, 2) as $row) @foreach($row as $img) @endforeach @endforeach @if($mapImage)
Property Location
@endif
@if($contactAvatar) @else
{{ substr($contactPerson->name ?? 'A', 0, 1) }}
@endif
{{ $contactPerson->name ?? 'Property Consultant' }}
{{ $roleLabel }}
@if($phone) WhatsApp Call Agent @endif @if(isset($contactPerson) && $contactPerson->email) Email @endif
Premium Property Marketing
@endif