From 042a3405e903b25204a5749877cdc6f3c4d4f04c Mon Sep 17 00:00:00 2001 From: DenSardonic Date: Mon, 9 Dec 2024 21:35:16 +0000 Subject: [PATCH] Update HasSpatial.php This trait crash model relations by overriding model options with the ones from relation (e.g. id). Please consider this change as fix --- src/Traits/HasSpatial.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Traits/HasSpatial.php b/src/Traits/HasSpatial.php index 1b94553..49fbf6d 100644 --- a/src/Traits/HasSpatial.php +++ b/src/Traits/HasSpatial.php @@ -59,7 +59,7 @@ public function newQuery(): Builder $raw = substr($raw, 0, -2); - return parent::newQuery()->addSelect('*', DB::raw($raw)); + return parent::newQuery()->addSelect($this->getTable() . '.*', DB::raw($raw)); } public function getLocationCastedAttributes(): Collection