@if (!empty($results))
@foreach ($results as $groupName => $data)
{{ __($groupName) }}
@forelse ($data['items'] as $item)
@php
$displayText = $item->{$data['display_field']};
$link = '#'; // Default link
if (!empty($data['route_name'])) {
// Assuming your route needs an 'id' parameter. Adjust as needed.
// You might need to pass the primary key name if it's not 'id'.
try {
$link = route($data['route_name'], $item->id);
} catch (\Exception $e) {
// Handle cases where route generation fails (e.g., route not found, missing parameters)
$link = '#';
// Log::error("Error generating route {$data['route_name']}: " . $e->getMessage());
}
}
@endphp
{{-- You can add an icon here if you have a way to determine it --}}
{{ $displayText }}
@empty
No results found in {{ $groupName }}.
@endforelse
@endforeach
@elseif (strlen($search) >= 3)
No results found for "{{ $search }}".
@endif
@endif