At our rehab clinic, we provide compassionate, evidence-based support each individual's journey toward lasting recovery.
@foreach($contact_info as $index => $item)
@php
$iconImg = $item->galleries($contact_category_id)->first(); // Category ID for contact is usually 1, 2, or 3 based on id_array but I created one with 'contact' slug.
// Wait, the controller used getCategoryId() which creates/returns ID for 'contact'.
// I'll check what that ID is. (Actually I'll just use the galleries relationship)
$iconPath = getgallery($iconImg);
// Fallback icons based on name
if (!$iconPath) {
$nameLower = strtolower($item->name);
if (str_contains($nameLower, 'phone') || str_contains($nameLower, 'contact')) $iconPath = asset('images/icon-phone.svg');
elseif (str_contains($nameLower, 'mail') || str_contains($nameLower, 'email')) $iconPath = asset('images/icon-mail.svg');
elseif (str_contains($nameLower, 'address') || str_contains($nameLower, 'location')) $iconPath = asset('images/icon-location.svg');
elseif (str_contains($nameLower, 'hour') || str_contains($nameLower, 'clock') || str_contains($nameLower, 'time')) $iconPath = asset('images/icon-clock.svg');
else $iconPath = asset('images/icon-phone.svg');
}
@endphp