Skip to content

Commit

Permalink
Update Actions.php
Browse files Browse the repository at this point in the history
  • Loading branch information
MoamenEltouny committed Sep 20, 2021
1 parent 72c6c70 commit 629a934
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Traits/Actions.php
Expand Up @@ -42,8 +42,18 @@ protected function getTranslation(?string $locale = null): ?Model

$this->hasTranslation($locale);

if (isset($this->translations[$locale]))
if (isset($this->translations[$locale])) {
if (is_array($this->translations[$locale])) {
$item = $this->getTranslatableModel();
$item = new $item();
$item->locale = $locale;
$item->{$this->getTranslatableField()} = $this->getKey();
$item->fill($this->translations[$locale]);
$this->addTranslatableWithLocale($locale, $item);
}

return $this->translations[$locale];
}

return null;
}
Expand Down

0 comments on commit 629a934

Please sign in to comment.