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