From f1b155ade8ac0ffdf5147354bc8ef2751ae39a6f Mon Sep 17 00:00:00 2001 From: RD Date: Wed, 11 Sep 2024 16:56:04 +0300 Subject: [PATCH] Fix cast issue in TranslatableFieldMixin Ensure non-empty values are cast to string only if not null, enhancing data handling and preventing unintended type conversion for empty strings. --- src/TranslatableFieldMixin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TranslatableFieldMixin.php b/src/TranslatableFieldMixin.php index 4422615..7c0b8fc 100644 --- a/src/TranslatableFieldMixin.php +++ b/src/TranslatableFieldMixin.php @@ -76,7 +76,7 @@ public function translatable() : config('nova-translatable.fill_other_locales_from', null); // Fix strings being casted to floats - if ($this instanceof Text && !$this instanceof Number) { + if ($this instanceof Text && !$this instanceof Number && !empty($value)) { foreach ($value as $key => $val) { $value[$key] = ($val === null ? null : (string) $val); }