@php $ratings = [ 'Outstanding', 'Good', 'Requires improvement', 'Inadequate', 'Inspected but not rated', ]; $localAuthoritiesFile = resource_path('data/local_authorities.json'); $localAuthorities = file_exists($localAuthoritiesFile) ? json_decode(file_get_contents($localAuthoritiesFile), true) : []; // Determine the active search context $endpoint = request('endpoint'); if (empty($endpoint)) { if (request()->routeIs('providers.index') || request()->routeIs('providers.index.filter') || request()->routeIs('providers.show') || request()->path() === 'providers') { $endpoint = 'providers'; } else { $endpoint = 'locations'; } } // Read from route parameters (resolved by controller) or fallback to request $type = $type ?? request()->route('type') ?? request('type', 'any'); $overallRating = $overallRating ?? request()->route('overallRating') ?? request('overallRating'); $localAuthority = $localAuthority ?? request()->route('localAuthority') ?? request('localAuthority'); // Check if any filters are currently active to show reset option before normalizing for display $isFiltered = (!empty($overallRating) && $overallRating !== 'all') || (!empty($localAuthority) && $localAuthority !== 'all') || (!empty($type) && $type !== 'any'); // Normalize rating for option selection if ($overallRating === 'all') { $overallRating = ''; } // Normalize local authority back to canonical name for input display if (!empty($localAuthority) && $localAuthority !== 'all') { $searchSlug = strtolower(str_replace(' ', '-', preg_replace('/[^a-zA-Z0-9\s-]/', '', $localAuthority))); $matchedAuthority = null; foreach ($localAuthorities as $la) { if (\Illuminate\Support\Str::slug($la) === $searchSlug || strtolower($la) === strtolower($localAuthority)) { $matchedAuthority = $la; break; } } $localAuthority = $matchedAuthority ?? str_replace('-', ' ', $localAuthority); } else { $localAuthority = ''; } $normalizeType = function($t) { return strtolower(str_replace([' ', '_', '+', '-'], '', $t ?? '')); }; @endphp

Search & Filter Healthcare Registry

Reset
@if(request()->routeIs('locations.show') || request()->routeIs('providers.show')) @endif