public function getAttribute($key)
    {
        if ($this->isKeyReturningTranslationText($key)) {
            if ($translation = $this->getTranslation()) {
                return $translation->$key;
            }

            # fallback: try to find default locale values
            if ($translation = $this->getTranslation(\localizer\getDefault()->id())) {
                return $translation->$key;
            }

            return null;
        }

        return parent::getAttribute($key);
    }
public function getAttribute($key)
    {
        if ($this->isKeyReturningTranslationText($key)) {
            if ($translation = $this->getTranslation()) {
                return $translation->$key;
            }

            # fallback: try to find default locale values
            if ($translation = $this->getTranslation(\localizer\getDefault()->id())) {
                return $translation->$key;
            }

            return null;
        }

        return parent::getAttribute($key);
    }
public function getAttribute ( $ key ) { if ( $ this -> isKeyReturningTranslationText ( $ key ) ) { if ( $ translation = $ this -> getTranslation ( ) ) { return $ translation -> $ key ; } # fallback: try to find default locale values if ( $ translation = $ this -> getTranslation ( \ localizer \ getDefault ( ) -> id ( ) ) ) { return $ translation -> $ key ; } return null ; } return parent :: getAttribute ( $ key ) ; }
Translatable attribute accessor

@param $key
@return mixed|null
Translatable attribute accessor