12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace App\Services;
- use App\Models\SysRegion;
- use Slowlyo\OwlAdmin\Services\AdminService;
- class SysRegionService extends AdminService
- {
- protected string $modelName = SysRegion::class;
-
- public function getProvinceList()
- {
- return $this->query()->where('depth', 1)->get();
- }
-
- 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();
- }
- }
|