@php // Switched off in Admin -> Pages: the band does not draw, on any layout that includes it. if (!section_on('popular-restaurants')) { return; } /** * Popular Restaurants — curated, editorial restaurant rails (top-rated / fastest / newest). * This is house CURATION, not advertising: every card is a real restaurant pulled from a * ranking query. The section carries exactly two genuine ad slots, both dynamic and both * rendered through cards/ad with their own "Sponsored" label: * - "home_tall" — the tall column beside the first rail * - "home_card" — the fourth card in the last rail * With no campaign booked either slot falls back to the theme-options image, never a * hardcoded promo. * @var array $collections list of ['title','subtitle','url','items'] */ $collections = collect($collections ?? [])->all(); // accepts an array or a collection // Only rails that actually have restaurants, so the slot indexes below stay stable // even when a rail is skipped for having nothing unique left to show. $rails = array_values(array_filter($collections, static fn (array $c): bool => !empty($c['items']))); if (!$rails) { return; } $lastIdx = count($rails) - 1; $tallAd = active_ad('home_tall'); $cardAd = active_ad('home_card'); /** Up to 3 curated restaurant cards for a rail (thirds). */ $cards = function (array $items) use ($__env): string { ob_start(); @endphp
@foreach (array_slice($items, 0, 3) as $r)
@partial('cards/restaurant', ['r' => $r])
@endforeach
@php return (string) ob_get_clean(); }; /** The sponsored slot markup, or the theme-options fallback image when unsold. */ $adSlot = function (\App\Models\AdCampaign|array|null $ad, string $variant) use ($__env): string { if ($ad) { return partial('cards/ad', ['ad' => $ad, 'variant' => $variant]); } return '
'; }; @endphp
{{ t_raw('home.popular_restaurants.eyebrow') }}

{{ t_raw('home.popular_restaurants.title') }}

@foreach ($rails as $idx => $col)

{{ $col['title'] }}

@if (!empty($col['subtitle']))

{{ $col['subtitle'] }}

@endif
{{ t_raw('common.view_all') }}
@if ($idx === 0)
@php /* AN UNSOLD SLOT SHOWS ONE MORE RESTAURANT. The column is kept at its own width rather than collapsed — dropping it would widen the three cards beside it and change the whole rail — so the space simply goes to the next restaurant instead of to a fallback image. */ @endphp
@if ($tallAd) {!! $adSlot($tallAd, 'tall') !!} @elseif (isset($col['items'][3])) @partial('cards/restaurant', ['r' => $col['items'][3]]) @endif
{!! $cards($col['items']) !!}
@elseif ($idx === $lastIdx) @php /* Last rail runs four across: three curated restaurants + one sponsored card. */ @endphp
@foreach (array_slice($col['items'], 0, 3) as $r)
@partial('cards/restaurant', ['r' => $r])
@endforeach @php // Unsold: a fourth restaurant takes the cell, so the rail still runs four across. @endphp
@if ($cardAd) {!! $adSlot($cardAd, 'box') !!} @elseif (isset($col['items'][3])) @partial('cards/restaurant', ['r' => $col['items'][3]]) @endif
@else {!! $cards($col['items']) !!} @endif
@endforeach