<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Property;

class PublicPropertyController extends Controller
{
    public function show(Property $property)
{
    $property->load('propertyType');

    // Obtener precios específicos de cada mes desde el PropertyType
    $priceByMonth = [];
    $monthKeys = [
        'january', 'february', 'march', 'april', 'may', 'june',
        'july', 'august', 'september', 'october', 'november', 'december'
    ];

    foreach ($monthKeys as $key) {
        $priceByMonth[$key] = $property->propertyType->{'price_' . $key};
    }

    return view('properties.public', [
        'property' => $property,
        'priceByMonth' => $priceByMonth,
    ]);
}

}
