Skip to content

Commit db6cc86

Browse files
committed
lat and lng casted to float in LocationCast
1 parent 607a688 commit db6cc86

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Casts/LocationCast.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public function get($model, string $key, $value, array $attributes): Point
2020
if (count($coordinates) > 1) {
2121
$location = explode(',', str_replace(['POINT(', ')', ' '], ['', '', ','], $coordinates[0]));
2222

23-
return new Point(lat: $location[1], lng: $location[0], srid: $coordinates[1]);
23+
return new Point(lat: (float) $location[1], lng: (float) $location[0], srid: (int) $coordinates[1]);
2424
}
2525

2626
$location = explode(',', str_replace(['POINT(', ')', ' '], ['', '', ','], $value));
2727

28-
return new Point(lat: $location[1], lng: $location[0]);
28+
return new Point(lat: (float) $location[1], lng: (float) $location[0]);
2929
}
3030

3131
public function set($model, string $key, $value, array $attributes): Expression

0 commit comments

Comments
 (0)