From 1e8a1f2aa4147176846376b40e3714c0b78ae5ca Mon Sep 17 00:00:00 2001 From: Adinnu Benedict Date: Fri, 5 Jan 2024 04:58:35 +0100 Subject: [PATCH] Update LocationCast.php Fixes the error explode(): Argument #2 ($string) must be of type string, Illuminate\Database\Query\Expression given --- src/Casts/LocationCast.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Casts/LocationCast.php b/src/Casts/LocationCast.php index 65bbf22..400e0b8 100644 --- a/src/Casts/LocationCast.php +++ b/src/Casts/LocationCast.php @@ -17,6 +17,10 @@ public function get($model, string $key, $value, array $attributes): ?Point { if (is_null($value)) { return null; + } + + if (gettype($value) !== "string") { + return null; } $coordinates = explode(',', $value);