src/Traits/Translatable.php
public function setAttribute($attribute, $value)
    {
        if ($this->isTranslatable($attribute) && !empty($value)) {
            // If a translation code has not yet been set, generate one:
            if (!$this->translationCodeFor($attribute)) {
                $reflected                                    = new \ReflectionClass($this);
                $group                                        = 'translatable';
                $item                                         = strtolower($reflected->getShortName()) . '.' . strtolower($attribute) . '.' . Str::random();
                $this->attributes["{$attribute}_translation"] = "$group.$item";
            }
        }
        return parent::setAttribute($attribute, $value);
    }
public function setAttribute($attribute, $value)
    {
        if ($this->isTranslatable($attribute) && !empty($value)) {
            // If a translation code has not yet been set, generate one:
            if (!$this->translationCodeFor($attribute)) {
                $reflected                                    = new \ReflectionClass($this);
                $group                                        = 'translatable';
                $item                                         = strtolower($reflected->getShortName()) . '.' . strtolower($attribute) . '.' . Str::random();
                $this->attributes["{$attribute}_translation"] = "$group.$item";
            }
        }
        return parent::setAttribute($attribute, $value);
    }
public function setAttribute ( $ attribute , $ value ) { if ( $ this -> isTranslatable ( $ attribute ) && ! empty ( $ value ) ) { // If a translation code has not yet been set, generate one: if ( ! $ this -> translationCodeFor ( $ attribute ) ) { $ reflected = new \ ReflectionClass ( $ this ) ; $ group = 'translatable' ; $ item = strtolower ( $ reflected -> getShortName ( ) ) . '.' . strtolower ( $ attribute ) . '.' . Str :: random ( ) ; $ this -> attributes [ "{$attribute}_translation" ] = "$group.$item" ; } } return parent :: setAttribute ( $ attribute , $ value ) ; }
Hijack Eloquent's setAttribute to create a Language Entry, or update the existing one, when setting the value of this attribute.

@param  string  $attribute    Attribute name
@param  string  $value  Text value in default locale.
@return void
Hijack Eloquent s setAttribute to create a Language Entry or update the existing one when setting the value of this attribute .