@extends('layouts.main') @section('title') Home @endsection @section('style') @endsection @section('content')

{{ __('contents.mainHeadingHome') }} {{ __('contents.mainHeadingHome2') }}

{{ __('contents.headerSlogan') }}

{{ __('contents.listings') }} {{ __('contents.forYou') }}

{{ __('contents.listingpara') }}

@php $j=0; @endphp @foreach($featured_properties as $prop) @php $prop->incrementImpression(); // 🟒 FIX: Reorder gallery array to lead with the "caught" thumbnail $gallery = getMediaByType($prop->id, 'image'); $cover = $prop->thumbnail; if($cover && in_array($cover, $gallery)){ $gallery = array_diff($gallery, [$cover]); array_unshift($gallery, $cover); } $gallery = array_values($gallery); // Reset keys to 0, 1, 2... for indicators $type = \App\Models\Property_Type::findorfail($prop->property_type); $commune = \App\Models\Commune::where('code', $prop->commune)->first(); $district = \App\Models\District::where('code', $prop->district)->first(); $province = \App\Models\Province::where('code', $prop->province)->first(); $info = (!empty($prop->Info)) ? json_decode($prop->Info) : (object)[]; @endphp
{{ (mb_strlen($prop->{'title_'.app()->getLocale()}, 'UTF-8') > 25) ? mb_substr($prop->{'title_'.app()->getLocale()}, 0, 21, 'UTF-8') . "..." : $prop->{'title_'.app()->getLocale()} }} @php $full_address = ($commune->{'name_'.app()->getLocale()} ?? '').", ".($district->{'name_'.app()->getLocale()} ?? '').", ".($province->{'name_'.app()->getLocale()} ?? ''); @endphp
{{ strlen($full_address) > 35 ? substr($full_address, 0, 34) . '...' : $full_address }}
    @if(!empty($info->bedrooms))
  • {{ $info->bedrooms }}
  • @endif @if(!empty($info->car_parking))
  • {{ $info->car_parking }}
  • @endif @if(!empty($info->land_area))
  • {{ $info->land_area }} m2
  • @endif
@php $j++; @endphp @endforeach
@if(count($types) > 0)

{{ __('contents.explorePopular') }} {{ __('contents.types') }}

{{ __('contents.typesText') }}

@foreach($types as $t) @php $type = \App\Models\Property_Type::find($t); $type_prop = \App\Models\Property::where('property_type',$t)->get(); $image = !empty($type->image) ? $type->image : "default.png"; @endphp
{{ $type->{'title_'.app()->getLocale()} }}

{{ count($type_prop) }} {{ count($type_prop) > 1 ? 'Properties' : 'Property' }}

@endforeach
@endif @if(count($rentals) > 0)

{{ __('contents.latest') }} {{ __('contents.other') }} {{ __('contents.rentals') }}

{{ __('contents.newOtherRental') }}

@foreach($rentals as $rental) @php $rental->incrementImpression(); // 1. Get the full gallery $rental_gallery = getMediaByType($rental->id,'image','rental'); // 🟒 2. THE UPDATE: Reorder to catch the manual cover selection $r_cover = $rental->thumbnail; if ($r_cover && in_array($r_cover, $rental_gallery)) { // Remove cover from current spot and move to index 0 $rental_gallery = array_diff($rental_gallery, [$r_cover]); array_unshift($rental_gallery, $r_cover); $rental_gallery = array_values($rental_gallery); } // 3. Determine the primary display image $first_image = !empty($rental_gallery[0]) ? asset("uploads/media/$rental_gallery[0]") : asset('uploads/Type/default.png'); $province = \App\Models\Province::where('code',$rental->province)->first(); $district = \App\Models\District::where('code',$rental->district)->first(); $commune = \App\Models\Commune::where('code',$rental->commune)->first(); $village = !empty($rental->village) ? \App\Models\Village::where('code',$rental->village)->first() : null; // safe address logic remains $parts = []; if(!empty($rental->address)) $parts[] = $rental->address; if($village) $parts[] = $village->{'name_'.app()->getLocale()} ?? ''; if($commune) $parts[] = $commune->{'name_'.app()->getLocale()} ?? ''; if($district) $parts[] = $district->{'name_'.app()->getLocale()} ?? ''; if($province) $parts[] = $province->{'name_'.app()->getLocale()} ?? ''; $address = implode(', ', array_filter($parts)); $address = $address ? $address . ', Cambodia' : 'Cambodia'; $type = \App\Models\Rental_Type::findorfail($rental->type); @endphp
{{ (mb_strlen($rental->{'title_'.app()->getLocale()}, 'UTF-8') > 25) ? mb_substr($rental->{'title_'.app()->getLocale()}, 0, 25, 'UTF-8') . "..." : $rental->{'title_'.app()->getLocale()} }}
{{ $address }}
{{ time_ago($rental->created_at) }}
@endforeach
@endif @if(count($districts) > 0)

{{ __('contents.findProperty') }} {{ __('contents.pProperty') }}

{{ __('contents.locationText') }}

@foreach($districts as $d) @php $district = \App\Models\Province::where('code',$d)->first(); $district_prop = \App\Models\Property::where('province',$d)->get(); if(!empty($district->image)){ $image = $district->image; }else{ $image = "default.png"; } @endphp
{{ $district->{'name_'.app()->getLocale() } }}
@if(count($district_prop) > 1)

{{ count($district_prop) }} Properties

@else

{{ count($district_prop) }} Property

@endif
@endforeach
@endif

IT'S ALL ABOUT PROPERTY FOR RENT.

A platform where agents or landlordscan upload properties, and where renters can find a place to rent.

@if($testimonials->count() > 0)
CLIENT Feedback

Don’t Trust us, Trust Our Client.

{{-- βœ… TESTIMONIALS (Swiper + autoplay 3s + fade + clickable dots) --}}
@endif @endsection @section('script') @endsection