protected function translateOrNew(string $locale): Model
    {
        if (isset($this->translationCache[$locale])) {
            return $this->translationCache[$locale];
        }

        if (!$this->exists) {
            return $this->translations()->newModelInstance(['locale' => $locale]);
        }

        return $this->translations()
            ->where('locale', $locale)
            ->firstOrNew(['locale' => $locale]);
    }
protected function translateOrNew(string $locale): Model
    {
        if (isset($this->translationCache[$locale])) {
            return $this->translationCache[$locale];
        }

        if (!$this->exists) {
            return $this->translations()->newModelInstance(['locale' => $locale]);
        }

        return $this->translations()
            ->where('locale', $locale)
            ->firstOrNew(['locale' => $locale]);
    }
protected function translateOrNew ( string $ locale ) : Model { if ( isset ( $ this -> translationCache [ $ locale ] ) ) { return $ this -> translationCache [ $ locale ] ; } if ( ! $ this -> exists ) { return $ this -> translations ( ) -> newModelInstance ( [ 'locale' => $ locale ] ) ; } return $ this -> translations ( ) -> where ( 'locale' , $ locale ) -> firstOrNew ( [ 'locale' => $ locale ] ) ; }
Get a translation or create new.

@param string $locale

@return \Illuminate\Database\Eloquent\Model
Get a translation or create new .