From 9202366989bafcf289615be872d409bde9c8f5aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Nagy=20Gerg=C5=91?= Date: Tue, 2 Jan 2024 21:43:28 +0100 Subject: [PATCH] fix meta value cast --- src/Casts/MetaValue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Casts/MetaValue.php b/src/Casts/MetaValue.php index 2f276c29d..55b7fe255 100644 --- a/src/Casts/MetaValue.php +++ b/src/Casts/MetaValue.php @@ -15,7 +15,7 @@ class MetaValue implements CastsAttributes */ public function get(Model $model, string $key, mixed $value, array $attributes): mixed { - return json_decode($value, true) ?? $value; + return is_null($value) ? $value : (json_decode($value, true) ?? $value); } /**