Skip to content

Commit 629a934

Browse files
Update Actions.php
1 parent 72c6c70 commit 629a934

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Traits/Actions.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,18 @@ protected function getTranslation(?string $locale = null): ?Model
4242

4343
$this->hasTranslation($locale);
4444

45-
if (isset($this->translations[$locale]))
45+
if (isset($this->translations[$locale])) {
46+
if (is_array($this->translations[$locale])) {
47+
$item = $this->getTranslatableModel();
48+
$item = new $item();
49+
$item->locale = $locale;
50+
$item->{$this->getTranslatableField()} = $this->getKey();
51+
$item->fill($this->translations[$locale]);
52+
$this->addTranslatableWithLocale($locale, $item);
53+
}
54+
4655
return $this->translations[$locale];
56+
}
4757

4858
return null;
4959
}

0 commit comments

Comments
 (0)