@php $class = $class ?? ''; $file = $file ?? null; if (! $file && ! empty($name)) { $candidates = [$name.'.png']; foreach (glob(public_path('screenshots/*_'.$name.'.png')) ?: [] as $match) { $candidates[] = basename($match); } foreach (glob(public_path('screenshots/*_'.$name.'_*.png')) ?: [] as $match) { $candidates[] = basename($match); } foreach ($candidates as $candidate) { if (file_exists(public_path('screenshots/'.$candidate))) { $file = $candidate; break; } } } $hasImg = $file && file_exists(public_path('screenshots/'.$file)); @endphp @if ($hasImg) {{ $alt }} @else
{{ $title ?? $alt }}
@endif