@php $categoryId = $categoryId ?? null; $ads = isset($ads) ? $ads : (function () use ($categoryId) { try { $user = auth()->user(); // For authenticated, show global ads; for vendor users, show vendor-specific $vendorId = $user ? $user->vendor_id : null; return getTopNoteAds($vendorId, null, $categoryId); } catch (\Throwable $e) { return collect(); } })(); @endphp @if ($ads && $ads->count()) @once @push('styles') @endpush @push('head-scripts') @endpush @push('scripts') @endpush @endonce
@foreach ($ads as $ad)
@if ($ad->link_url) {{ $ad->title ?? 'Ad' }} @else {{ $ad->title ?? 'Ad' }} @endif
@endforeach
@endif