@php $c = is_array($contact) ? $contact : (array) $contact; $languageSwitcher = isset($c['lang_switcher']) && $c['lang_switcher'] == 1; $email = $c['email'] ?? null; $phone = $c['contact_no'] ?? null; $from = $c['from_time'] ?? null; $to = $c['to_time'] ?? null; try { $fromLabel = $from ? \Carbon\Carbon::parse($from)->format('g:ia') : null; $toLabel = $to ? \Carbon\Carbon::parse($to)->format('g:ia') : null; } catch (\Throwable $e) { $fromLabel = $from; $toLabel = $to; } $telHref = $phone ? 'tel:' . preg_replace('/(?!^\+)[^\d]/', '', $phone) : null; $norm = function ($url) { if (!$url) return null; $url = trim($url); if ($url === '#' || $url === '') return null; if (!preg_match('~^https?://~i', $url)) { $url = 'https://' . $url; } return $url; }; $facebook = $norm($c['facebook_url'] ?? null); $twitter = $norm($c['twitter_url'] ?? null); $linkedin = $norm($c['linkedin_url'] ?? null); $instagram= $norm($c['instagram_url']?? null); $youtube = $norm($c['youtube_url']?? null); $hasAny = $email || $phone || ($fromLabel && $toLabel) || $facebook || $twitter || $linkedin || $instagram || $youtube; @endphp @if($hasAny)
@if($email) @endif @if($phone) @endif @if($fromLabel && $toLabel)
Opening: {{ $fromLabel }} - {{ $toLabel }}
@endif @if($facebook || $twitter || $linkedin || $instagram) @endif {{-- Language Switch Dropdown --}} @if($languageSwitcher)
@endif
@endif