diff --git a/.gitignore b/.gitignore index d054a8cb..7f425da8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ /.phpunit.cache /build/ /coverage.clover +.DS_Store +.idea/* diff --git a/src/Translatable/Traits/Relationship.php b/src/Translatable/Traits/Relationship.php index 22832dc5..d1911ff6 100644 --- a/src/Translatable/Traits/Relationship.php +++ b/src/Translatable/Traits/Relationship.php @@ -25,7 +25,7 @@ public function getRelationKey(): string */ public function getTranslationModelName(): string { - return $this->translationModel ?: $this->getTranslationModelNameDefault(); + return isset($this->translationModel) ? $this->translationModel : $this->getTranslationModelNameDefault(); } /** @@ -55,11 +55,7 @@ public function getTranslationModelNamespace(): ?string */ public function getTranslationRelationKey(): string { - if ($this->translationForeignKey) { - return $this->translationForeignKey; - } - - return $this->getForeignKey(); + return isset($this->translationForeignKey) ? $this->translationForeignKey : $this->getForeignKey(); } public function translation(): HasOne diff --git a/src/Translatable/Translatable.php b/src/Translatable/Translatable.php index 966fe954..c83c4823 100644 --- a/src/Translatable/Translatable.php +++ b/src/Translatable/Translatable.php @@ -174,7 +174,7 @@ public function getDefaultLocale(): ?string */ public function getLocaleKey(): string { - return $this->localeKey ?: config('translatable.locale_key', 'locale'); + return isset($this->localeKey) ? $this->localeKey : config('translatable.locale_key', 'locale'); } public function getNewTranslation(string $locale): Model