Total Complexity | 3 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | trait RegionTrait |
||
27 | { |
||
28 | |||
29 | public static function bootRegionTrait() |
||
30 | { |
||
31 | static::deleting(function ($model) { |
||
32 | $model->region->each(fn(Region $region) => $region->delete()); |
||
33 | }); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * 关联地区 |
||
38 | * @return mixed |
||
39 | */ |
||
40 | public function region() |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * 按距离查询 |
||
47 | * @param mixed $query |
||
48 | * @param array $codes |
||
49 | * @return mixed |
||
50 | */ |
||
51 | public function scopeWithGeoDistance($query, float $lat,float $lng,int $distance = 5000) |
||
60 |