<?php

namespace App\Http\Controllers;

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

class PropertyFacilityController extends Controller
{
    public function index()
    {
        try {
            $prop = PropertyFacility::with(['properties'])
            ->latest()
                ->paginate(10);
                

            return response()->json([
                'status' => 'success',
                'property' => $prop
            ], 200);
        } catch (\Exception $e) {
            return response()->json([
                'success' => false,
                'message' => 'Failed to retrieve facility properties.',
                'error' => $e->getMessage()
            ], 500);
        }
    }
}
