diff --git a/src/Geolocatable.php b/src/Geolocatable.php index 43ce4ac..be57ebf 100644 --- a/src/Geolocatable.php +++ b/src/Geolocatable.php @@ -9,4 +9,6 @@ interface Geolocatable public function getAddressForGeolocation(): ?Address; public function destroyCoordinate(): void; + + public function needsGeolocationUpdate(): bool; } diff --git a/src/HasGeolocation.php b/src/HasGeolocation.php index b7a50b5..735ceec 100644 --- a/src/HasGeolocation.php +++ b/src/HasGeolocation.php @@ -12,7 +12,10 @@ trait HasGeolocation if (!static::$geolocationEnabled) { return; } - dispatch(new FillCoordsJob($model)); + + if ($model->needsGeolocationUpdate()) { + dispatch(new FillCoordsJob($model)); + } }); }