Skip to content

Commit

Permalink
Fix setTranslation
Browse files Browse the repository at this point in the history
  • Loading branch information
petrzpav committed Nov 11, 2024
1 parent 1e39f3a commit 0e984cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Traits/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,19 @@ public function setAttribute($key, $value)
}

$locale = app()->getLocale();
$fallbackLocale = app()->getFallbackLocale();
$this->setTranslation($key, $locale, $value);
Cache::forget($this->getTraslationCacheKey($key, $locale, $fallbackLocale));

return $this;
}

public function setTranslation($attribute, $locale, $value)
{
$fallbackLocale = app()->getFallbackLocale();
$this->translations()->updateOrCreate(
['attribute' => $key, 'locale' => $locale],
['value' => $value]
);
Cache::forget($this->getTraslationCacheKey($key, $locale, $fallbackLocale));
}

/**
Expand Down

0 comments on commit 0e984cd

Please sign in to comment.