<?php

namespace App\Services\Property;

use App\Models\Land;
use App\Models\Property;

class LandService implements PropertyInterface
{
    public function createProperty($data)
    {
        $property = Property::create($data);
        $data['property_id'] = $property->id;
        Land::create($data);
        return $property;
    }

    public function update_Property($propertyId, $data)
    {
        $property = Property::find($propertyId);
        if (!$property || !$property->land) return false;
        $property->update($data);
        $property->land->update($data);
        return $property;
    }

    public function getProperty($propertyId)
    {
        return Property::with('land')->find($propertyId);
    }
}
