Test Setup Failed
Push — master ( ad0913...368932 )
by Dennis
14:58
created
database/migrations/2024_07_26_173507_create_regions_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      */
12 12
     public function up(): void
13 13
     {
14
-        Schema::create('regions', function (Blueprint $table) {
14
+        Schema::create('regions', function(Blueprint $table) {
15 15
             $table->id();
16 16
             $table->string('name')->comment('社区名称');
17 17
             $table->string('city_code')->comment("城市代码");
Please login to merge, or discard this patch.
src/Models/Region.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
 
9 9
 /**
10 10
  * Region Model
11
- 
12 11
  * @author Dennis Lui <[email protected]>
13 12
  *
14 13
  * @property string $id 主键
Please login to merge, or discard this patch.
src/Traits/RegionTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     public static function bootRegionTrait()
29 29
     {
30
-        static::deleting(function ($model) {
30
+        static::deleting(function($model) {
31 31
             $model->region->each(fn(Region $region) => $region->delete());
32 32
         });
33 33
     }
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
      * @param array $codes
48 48
      * @return mixed
49 49
      */
50
-    public function scopeWithGeoDistance($query, float $lat,float $lng,int $distance = 5000)
50
+    public function scopeWithGeoDistance($query, float $lat, float $lng, int $distance = 5000)
51 51
     {
52 52
         $raw = "ST_Distance_Sphere(geo,ST_GeomFromText('POINT($lng $lat)',4326))";
53
-        return $query->whereHas('region', function ($q) use ($raw,$distance) {
54
-            $q->select(DB::raw($raw.' as distance'))->where("distance <= $distance");
53
+        return $query->whereHas('region', function($q) use ($raw, $distance) {
54
+            $q->select(DB::raw($raw . ' as distance'))->where("distance <= $distance");
55 55
         });
56 56
     }
57 57
 
Please login to merge, or discard this patch.
src/Services/DistanceService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     {
56 56
         $this->selectDistance($service, $lat, $lng, $column);
57 57
         $distanceRaw = $this->distanceRaw($lat, $lng, $column);
58
-        $service->setQuery(function (Builder $query) use ($distanceRaw, $maxDistance) {
58
+        $service->setQuery(function(Builder $query) use ($distanceRaw, $maxDistance) {
59 59
             $query->whereRaw("$distanceRaw <= $maxDistance");
60 60
         });
61 61
         return $service;
Please login to merge, or discard this patch.