query()->where('depth', 1)->get(); } /** * 获取省份(与getProvinceList相同) */ public function getProvince() { return $this->getProvinceList(); } /** * 获取指定省份的城市列表 */ public function getCity($provinceId) { return $this->query()->where('parent_id', $provinceId) ->where('depth', 2) ->get(); } /** * 获取指定城市的区域列表 */ public function getArea($cityId) { return $this->query()->where('parent_id', $cityId) ->where('depth', 3) ->get(); } /** * 获取所有省份 */ public function getAllProvince() { return $this->getProvinceList(); } /** * 获取所有城市 */ public function getAllCity() { return $this->query()->where('depth', 2)->get(); } /** * 获取所有区域 */ public function getAllArea() { return $this->query()->where('depth', 3)->get(); } /** * 获取所有街道 */ public function getAllStreet() { return $this->query()->where('depth', 4)->get(); } }