Spatie\Translatable\HasTranslations::setTranslation PHP Метод

setTranslation() публичный Метод

public setTranslation ( string $key, string $locale, $value )
$key string
$locale string
$value
    public function setTranslation(string $key, string $locale, $value)
    {
        $this->guardAgainstUntranslatableAttribute($key);
        $translations = $this->getTranslations($key);
        $oldValue = $translations[$locale] ?? '';
        if ($this->hasSetMutator($key)) {
            $method = 'set' . Str::studly($key) . 'Attribute';
            $value = $this->{$method}($value);
        }
        $translations[$locale] = $value;
        $this->attributes[$key] = $this->asJson($translations);
        event(new TranslationHasBeenSet($this, $key, $locale, $oldValue, $value));
        return $this;
    }