@php
$imageUrl = asset('no-image.png'); // Default to no-image.png
if (!empty($property->images) && is_array($property->images) && count($property->images) > 0) {
$firstImage = ltrim($property->images[0], '/');
// Check if it's already a full URL
if (filter_var($firstImage, FILTER_VALIDATE_URL)) {
$imageUrl = $firstImage;
} else {
$imageUrl = asset('storage/' . $firstImage);
}
}
@endphp

@if($property->is_featured)
Featured
@endif
{{ ucfirst(str_replace('_', ' ', $property->status)) }}
@if(!empty($property->images) && is_array($property->images) && count($property->images) > 1)
{{ count($property->images) }}
@endif
{{ $property->name }}
{{ $property->address }}
{{ match($property->property_type) {
'single_house' => '🏠 Single House',
'apartment' => '🏢 Apartment',
'commercial' => '🏭 Commercial',
'mixed_use' => '🏬 Mixed Use',
default => ucfirst(str_replace('_', ' ', $property->property_type))
} }}
@if($property->units->count() > 0)
{{ $property->units->count() }} unit{{ $property->units->count() > 1 ? 's' : '' }}
@php $vacantCount = $property->units->where('status', 'vacant')->count(); @endphp
@if($vacantCount > 0)
{{ $vacantCount }} available
@endif
@if($property->property_type != 'commercial')
@php
$unitBedrooms = $property->units->pluck('bedrooms')->filter();
$unitBathrooms = $property->units->pluck('bathrooms')->filter();
$minBeds = $unitBedrooms->min(); $maxBeds = $unitBedrooms->max();
$minBaths = $unitBathrooms->min(); $maxBaths = $unitBathrooms->max();
@endphp
@if($minBeds)
{{ $minBeds == $maxBeds ? $minBeds . ' bed' . ($minBeds > 1 ? 's' : '') : "$minBeds-$maxBeds beds" }}
@endif
@if($minBaths)
{{ $minBaths == $maxBaths ? $minBaths . ' bath' . ($minBaths > 1 ? 's' : '') : "$minBaths-$maxBaths baths" }}
@endif
@endif
@else
@if($property->bedrooms)
{{ $property->bedrooms }} bed{{ $property->bedrooms > 1 ? 's' : '' }}
@endif
@if($property->bathrooms)
{{ $property->bathrooms }} bath{{ $property->bathrooms > 1 ? 's' : '' }}
@endif
@endif
@if($property->square_footage)
{{ number_format($property->square_footage) }} sqft
@endif
@if($property->amenities && count($property->amenities) > 0)
@foreach(array_slice($property->amenities, 0, 3) as $amenity)
{{ ucfirst($amenity) }}
@endforeach
@if(count($property->amenities) > 3)
+{{ count($property->amenities) - 3 }} more
@endif
@endif
@if($property->units->count() > 0)
@php
$unitRents = $property->units->pluck('rent_amount')->filter();
$minRent = $unitRents->min();
$maxRent = $unitRents->max();
@endphp
@if($minRent && $maxRent)
@if($minRent == $maxRent)
UGX {{ number_format($minRent) }}/mo
@else
Starting from
UGX {{ number_format($minRent) }}/mo
@endif
@else
UGX {{ number_format($property->monthly_rent) }}/mo
@endif
@else
UGX {{ number_format($property->monthly_rent) }}/mo
@endif
View Details