@extends('app::layouts.app') @section('content') @php $totalListings = isset($allListingsTotal) ? (int) $allListingsTotal : (int) $listings->total(); $activeCategoryName = $selectedCategory?->name ? trim((string) $selectedCategory->name) : ''; $pageTitle = $activeCategoryName !== '' ? 'İkinci El '.$activeCategoryName.' İlanları ve Fiyatları' : 'İkinci El Araba İlanları ve Fiyatları'; $canSaveSearch = $search !== '' || ! is_null($categoryId); $normalizeQuery = static fn ($value): bool => ! is_null($value) && $value !== ''; $baseCategoryQuery = array_filter([ 'search' => $search !== '' ? $search : null, 'country' => $countryId, 'city' => $cityId, 'min_price' => $minPriceInput !== '' ? $minPriceInput : null, 'max_price' => $maxPriceInput !== '' ? $maxPriceInput : null, 'date_filter' => $dateFilter !== 'all' ? $dateFilter : null, 'sort' => $sort !== 'smart' ? $sort : null, ], $normalizeQuery); $clearFiltersQuery = array_filter([ 'search' => $search !== '' ? $search : null, ], $normalizeQuery); @endphp

{{ $pageTitle }}

{{ $activeCategoryName !== '' ? 'İkinci El '.$activeCategoryName.' kategorisinde' : 'İkinci El Araba kategorisinde' }} {{ number_format($totalListings, 0, ',', '.') }} ilan bulundu

@auth
@csrf
@else Arama Kaydet @endauth
@if($search !== '') @endif @if($categoryId) @endif @if($countryId) @endif @if($cityId) @endif @if($minPriceInput !== '') @endif @if($maxPriceInput !== '') @endif @if($dateFilter !== 'all') @endif
@if($listings->isEmpty())
Bu filtreye uygun ilan bulunamadı.
@else
@foreach($listings as $listing) @php $listingImage = $listing->getFirstMediaUrl('listing-images'); $isFavorited = in_array($listing->id, $favoriteListingIds ?? [], true); $priceValue = ! is_null($listing->price) ? (float) $listing->price : null; $locationParts = array_filter([ trim((string) ($listing->city ?? '')), trim((string) ($listing->country ?? '')), ], fn ($value) => $value !== ''); $locationText = implode(', ', $locationParts); @endphp @endforeach
@endif
{{ $listings->links() }}
@endsection