@extends('layouts.frontend') @push('title', get_phrase('Home | Atlas Directory Listing')) @push('meta')@endpush @push('css') @endpush @section('frontend_layout')
@foreach($types as $type)
{{-- Static slugs will get custom content --}} @if($type->slug == 'car') @php $models = App\Models\Amenities::where('type', 'car')->where('identifier', 'model')->get(); $brands = App\Models\Amenities::where('type', 'car')->where('identifier', 'brand')->get(); $years = App\Models\CarListing::distinct()->pluck('year'); @endphp
@elseif($type->slug == 'hotel')
@elseif($type->slug == 'restaurant')
@elseif($type->slug == 'beauty')
@elseif($type->slug == 'real-estate') @php $cities = App\Models\RealEstateListing::select('city')->groupBy('city')->get(); $realEstatecategory = App\Models\Category::where('type', 'real-estate')->get(); $highestPrice = ceil((App\Models\RealEstateListing::max('price') + 1) / 4) * 4; $searched_price = $highestPrice; $step = $highestPrice % 4 === 0 ? $highestPrice / 4 : ceil($highestPrice / 4); for ($i = 0; $i < $highestPrice; $i += $step) { $startPrice = $i; $endPrice = $i + $step - 1; if ($endPrice > $highestPrice) { $endPrice = $highestPrice; } $priceRanges[] = "$startPrice - $endPrice"; } @endphp
@else
@endif
@endforeach

{{ get_phrase('Browse Top Categories.') }}

@php $staticTypes = ['hotel', 'restaurant', 'car', 'real-estate', 'beauty']; // Listing count calculate $sortedCustomTypes = collect($customTypes)->map(function ($type) use ($staticTypes, $customlistings) { $typeSlug = $type->slug ?? ''; $tableMap = [ 'hotel' => 'hotel_listings', 'restaurant' => 'restaurant_listings', 'car' => 'car_listings', 'real-estate' => 'real_estate_listings', 'beauty' => 'beauty_listings', ]; if (in_array($typeSlug, $staticTypes)) { $tableName = $tableMap[$typeSlug] ?? null; $listingCount = $tableName ? \DB::table($tableName)->count() : 0; } else { $listingCount = $customlistings->where('type', $typeSlug)->count(); } // Add listing count to the object $type->listing_count = $listingCount; return $type; })->sortByDesc('listing_count'); @endphp @foreach($sortedCustomTypes as $type) @php $typeSlug = $type->slug ?? ''; $typeName = ucfirst(str_replace('-', ' ', $typeSlug)); $imageName = $type->image ?? ''; $logoName = $type->logo ?? ''; $listingCount = $type->listing_count ?? 0; @endphp @if ($listingCount > 0) {{-- Optional: Only show if count > 0 --}} @endif @endforeach

{{ get_phrase('Featured Listings') }}

@php $firstFilterClass = $types->first()->slug ?? ''; @endphp
@foreach($types as $key => $type) @endforeach
@foreach ($Totalhotels->sortByDesc('created_at')->take(8) as $hotelList) @php $images = json_decode($hotelList->image) ?? []; $image = isset($images[0]) ? $images[0] : null; $countryName = App\Models\Country::where('id', $hotelList->country)->first(); $cityName = App\Models\City::where('id', $hotelList->city)->first(); $claimStatus = App\Models\ClaimedListing::where('listing_id', $hotelList->id)->where('listing_type', 'hotel')->first(); @endphp
Hotel Image @php $is_in_wishlist = check_wishlist_status($hotelList->id, $hotelList->type); @endphp

{{ $hotelList->is_popular }}

@if(isset($claimStatus) && $claimStatus->status == 1) @endif {{ $hotelList->title }}

{{ $cityName->name ?? '' }}, {{ $countryName->name ?? '' }}

@php $reviews_count = App\Models\Review::where('listing_id', $hotelList->id)->where('user_id', '!=', $hotelList->user_id)->where('type', 'hotel')->where('reply_id', null)->count(); $total_ratings = App\Models\Review::where('listing_id', $hotelList->id)->where('user_id', '!=', $hotelList->user_id)->where('type', 'hotel')->where('reply_id', null)->sum('rating'); $average_rating = $reviews_count > 0 ? $total_ratings / $reviews_count : 0; @endphp

({{ $reviews_count }})

    @php if (isset($hotelList->feature) && is_array(json_decode($hotelList->feature))) { $features = json_decode($hotelList->feature); foreach ($features as $key => $item) { $feature = App\Models\Amenities::where('id', $item)->first(); if ($key < 2) { echo '
  • ' . $feature->name . '
  • '; } } $more_amenities = count(json_decode($hotelList->feature)); if ($more_amenities > 4) { echo "
  • +" . ($more_amenities - 4) . ' ' . get_phrase('More') . '
  • '; } } @endphp
{{ get_phrase('See Details') }}

{{ currency($hotelList->price) }}

/{{ get_phrase('night') }}

@endforeach @foreach ($Totalrestaurant->sortByDesc('created_at')->take(8) as $restaurantList) @php $resturentImage = json_decode($restaurantList->image) ?? []; $image = isset($resturentImage[0]) ? $resturentImage[0] : null; $countryNameR = App\Models\Country::where('id', $restaurantList->country)->first(); $cityNameR = App\Models\City::where('id', $restaurantList->city)->first(); $claimStatus = App\Models\ClaimedListing::where('listing_id', $restaurantList->id)->where('listing_type', 'restaurant')->first(); @endphp @endforeach @foreach ($Totalbeauty->sortByDesc('created_at')->take(8) as $beautyList) @php $beautyListImage = json_decode($beautyList->image) ?? []; $image = isset($beautyListImage[0]) ? $beautyListImage[0] : null; $countryNameB = App\Models\Country::where('id', $beautyList->country)->first(); $cityNameB = App\Models\City::where('id', $beautyList->city)->first(); $claimStatus = App\Models\ClaimedListing::where('listing_id', $beautyList->id)->where('listing_type', 'beauty')->first(); @endphp

{{ $beautyList->is_popular }}

@php $is_in_wishlist = check_wishlist_status($beautyList->id, $beautyList->type); @endphp
@php $reviews_count = App\Models\Review::where('listing_id', $beautyList->id)->where('user_id', '!=', $beautyList->user_id)->where('type', 'beauty')->where('reply_id', null)->count(); $total_ratings = App\Models\Review::where('listing_id', $beautyList->id)->where('user_id', '!=', $beautyList->user_id)->where('type', 'beauty')->where('reply_id', null)->sum('rating'); $average_rating = $reviews_count > 0 ? $total_ratings / $reviews_count : 0; @endphp

{{ number_format($average_rating, 1) }}

({{ $reviews_count }})

@if (open_status($beautyList->id, 'BeautyListing') === 'Open')

{{ get_phrase('Open') }}

@else

{{ get_phrase('Closed') }}

@endif
@endforeach @foreach ($TotalrealEstate->sortByDesc('created_at')->take(8) as $realEsate) @php $realEsateImage = json_decode($realEsate->image) ?? []; $image = isset($realEsateImage[0]) ? $realEsateImage[0] : null; $countryNameReal = App\Models\Country::where('id', $realEsate->country)->first(); $cityNameReal = App\Models\City::where('id', $realEsate->city)->first(); $claimStatus = App\Models\ClaimedListing::where('listing_id', $realEsate->id)->where('listing_type', 'real-estate')->first(); @endphp

{{ $realEsate->status }}

@php $is_in_wishlist = check_wishlist_status($realEsate->id, $realEsate->type); @endphp

{{ $cityNameReal->name }}, {{ $countryNameReal->name }}

@if(isset($claimStatus) && $claimStatus->status == 1) @endif {{ $realEsate->title }}

{{ Str::limit(strip_tags($realEsate->description), 100) }}

{{ $realEsate->bed }} {{ get_phrase('Bed') }}

{{ $realEsate->bath }} {{ get_phrase('Bath') }}

{{ $realEsate->size }} {{ get_phrase('sqft') }}

@if (!empty($realEsate->discount))

{{ currency($realEsate->discount) }}

{{ currency($realEsate->price) }}

@elseif(!empty($realEsate->price))

{{ currency($realEsate->price) }}

@endif
@endforeach @foreach ($Totalcar->sortByDesc('created_at')->take(8) as $carList) @php $carImage = json_decode($carList->image) ?? []; $image = isset($carImage[0]) ? $carImage[0] : null; $countryNameCar = App\Models\Country::where('id', $carList->country)->first(); $cityNameCar = App\Models\City::where('id', $carList->city)->first(); $fuelType = App\Models\Amenities::where('id', $carList->fuel_type)->first(); $engineSize = App\Models\Amenities::where('id', $carList->engine_size)->first(); $claimStatus = App\Models\ClaimedListing::where('listing_id', $carList->id)->where('listing_type', 'car')->first(); @endphp

{{ $carList->is_popular }}

@php $is_in_wishlist = check_wishlist_status($carList->id, $carList->type); @endphp
@if(isset($claimStatus) && $claimStatus->status == 1) @endif {{ $carList->title }}

{{ Str::limit(strip_tags($carList->description), 100) }}

  • {{ $engineSize->name ?? 'N/A' }}

  • {{ $carList->mileage ?? 'N/A' }}

  • {{ $fuelType->name ?? 'N/A' }}

@if (!empty($carList->discount_price))

{{ currency($carList->discount_price) }}

{{ currency($carList->price) }}

@elseif(!empty($carList->price))

{{ currency($carList->price) }}

@endif
{{ get_phrase('View details') }}
@endforeach @php $staticTypes = ['car', 'hotel', 'real-estate', 'beauty', 'restaurant']; $groupedListings = $customlistings->groupBy('type'); @endphp @foreach($groupedListings as $type => $listingsByType) @foreach($listingsByType->sortByDesc('created_at')->take(8) as $listing) @php $dynamicImage = json_decode($listing->image) ?? []; $image = isset($dynamicImage[0]) ? $dynamicImage[0] : null; $countryNamed = App\Models\Country::where('id', $listing->country)->first(); $cityNamed = App\Models\City::where('id', $listing->city)->first(); $claimStatus = App\Models\ClaimedListing::where('listing_id', $listing->id)->where('listing_type', $listing->type)->first(); @endphp
Hotel Image @php $is_in_wishlist = check_wishlist_status($listing->id, $listing->type); @endphp

{{ $listing->is_popular }}

@if(isset($claimStatus) && $claimStatus->status == 1) @endif {{ $listing->title }}

{{ $cityNamed->name ?? '' }}, {{ $countryNamed->name ?? '' }}

@php $reviews_count = App\Models\Review::where('listing_id', $listing->id)->where('user_id', '!=', $listing->user_id)->where('type', $listing->type)->where('reply_id', null)->count(); $total_ratings = App\Models\Review::where('listing_id', $listing->id)->where('user_id', '!=', $listing->user_id)->where('type', $listing->type)->where('reply_id', null)->sum('rating'); $average_rating = $reviews_count > 0 ? $total_ratings / $reviews_count : 0; @endphp

({{ $reviews_count }})

    @php if (isset($listing->feature) && is_array(json_decode($listing->feature))) { $features = json_decode($listing->feature); foreach ($features as $key => $item) { $feature = App\Models\Amenities::where('id', $item)->first(); if ($key < 2) { echo '
  • ' . $feature->name . '
  • '; } } $more_amenities = count(json_decode($listing->feature)); if ($more_amenities > 4) { echo "
  • +" . ($more_amenities - 4) . ' ' . get_phrase('More') . '
  • '; } } @endphp
@endforeach
@if (!in_array($type, $staticTypes) && $listingsByType->count() > 7) @endif
@endforeach {{-- Listing Button Show --}}
@if ($Totalhotels->count() > 7) @endif
@if ($Totalrestaurant->count() > 7) @endif
@if ($Totalbeauty->count() > 7) @endif
@if ($TotalrealEstate->count() > 7) @endif
@if ($Totalcar->count() > 7) @endif
{{-- Listing Button Show --}}

{{ get_phrase('We Have Worked with ') }}{{ get_phrase('10,000') }}+{{ get_phrase(' Trusted Companies') }}

    @php $company_images = json_decode(get_frontend_settings('company_images'), true); @endphp @if (!empty($company_images) && is_array($company_images)) @foreach ($company_images as $images)
  • @endforeach @endif

{{ get_phrase('What the people Thinks About Us') }}

@if (count($reviews) > 0) @php $uniqueReviews = $reviews->unique('user_id'); @endphp @foreach ($uniqueReviews as $review) @php $users = App\Models\User::where('id', $review->user_id)->first(); @endphp
{{ $users->name }}

{{ \Carbon\Carbon::parse($review->created_at)->format('h:i A') }}

@for ($i = 1; $i <= 5; $i++) @if ($i <= $review->rating) @else @endif @endfor

@php $reviewWords = explode(' ', $review->review); $isLongReview = count($reviewWords) > 20; $shortReview = implode(' ', array_slice($reviewWords, 0, 20)); @endphp {{ $shortReview }} @if ($isLongReview) ... {{ get_phrase('read more') }} @endif

@endforeach @endif

{{ get_phrase('Pickup New Updates') }}

@if (count($blogs) > 0) @foreach ($blogs as $blog) @php $category_name = App\Models\Blog_category::where('id', $blog->category)->first(); $usersBlog = App\Models\User::where('id', $blog->user_id)->first(); @endphp @endforeach @endif
@endsection @push('js') {{-- Real Estate Wishlist --}} @if (Auth::check()) @else @endif {{-- Dynamic Wishlist --}} @if (Auth::check()) @else @endif {{-- Hotel Wishlist --}} @if (Auth::check()) @else @endif {{-- Restaurant Wishlist --}} @if (Auth::check()) @else @endif {{-- Beauty Wishlist --}} @if (Auth::check()) @else @endif {{-- Car Wishlist --}} @if (Auth::check()) @else @endif @endpush