diff --git a/src/HasTranslations.php b/src/HasTranslations.php index 3f0282e..a5b8753 100644 --- a/src/HasTranslations.php +++ b/src/HasTranslations.php @@ -49,14 +49,15 @@ protected function mutateAttributeForArray($key, $value): mixed public function setAttribute($key, $value) { - if ($this->isTranslatableAttribute($key)) { - if (is_array($value) && ! array_is_list($value)) { - return $this->setTranslations($key, $value); - } - return $this->setTranslation($key, $this->getLocale(), $value); + if (!$this->isTranslatableAttribute($key)) { + return parent::setAttribute($key, $value); + } + + if (is_array($value) && ! array_is_list($value)) { + return $this->setTranslations($key, $value); } - return parent::setAttribute($key, $value); + return $this->setTranslation($key, $this->getLocale(), $value); } public function translate(string $key, string $locale = '', bool $useFallbackLocale = true): mixed