Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
/.phpunit.cache
/build/
/coverage.clover
.DS_Store
.idea/*
8 changes: 2 additions & 6 deletions src/Translatable/Traits/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Translatable/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down