<?php


namespace App\Admin\Controllers;


use App\Http\Controllers\Controller;
use App\Models\Area;

class ApiController extends Controller
{

    public function getCity()
    {
        $id  = request('q');
        return Area::where(['level'=>2,'parent_id'=>intval($id)])->get(['name as text','id']);
    }

    public function getArea()
    {
        $id  = request('q');
        return Area::where(['level'=>3,'parent_id'=>intval($id)])->get(['name as text','id']);
    }
}
