<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\CarModel;
use App\Models\Trim;
use Illuminate\Http\Request;

class BrandModelController extends Controller
{
    public function getModels(Request $request)
    {
        $models = CarModel::where('brand_id', $request->brand_id)->get(['id', 'name']);

        return response()->json($models);
    }

    public function getTrims(Request $request)
    {
        $trims = Trim::where('car_model_id', $request->model_id)->get(['id', 'name']);

        return response()->json($trims);
    }
}
