@php // Same criteria as the guest list: newest approved first. approved_at lives on the // ticket, so it is read through the saleTicket() relation with withMax(), using // created_at as a tiebreaker. Unlike blogs, used machines have no division // relation, so this listing is global. $machines = \App\Models\SaleUsedMachine::with(['mainImage', 'saleTicket']) ->where('is_published', true) ->withMax('saleTicket', 'approved_at') ->orderByDesc('sale_ticket_max_approved_at') ->latest() ->limit(6) ->get(); @endphp @if ($machines->isNotEmpty())
@endif