<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Prefecture;
use App\Models\City;

class LocationController extends Controller
{
    public function getPrefectures(Request $request)
    {
        $prefectures = Prefecture::where('region_id', $request->region_id)->get();
        return response()->json($prefectures);
    }


    public function getCities(Request $request)
    {
        $cities = City::where('prefecture_id', $request->prefecture_id)->get();
        return response()->json($cities);
    }
}
