Skip to content

Commit

Permalink
Merge pull request #146 from Astrotomic/issue-145
Browse files Browse the repository at this point in the history
fix hardcoded locale column name
  • Loading branch information
Gummibeer authored Apr 23, 2020
2 parents e964450 + 6e368eb commit 4ce199d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Translatable/Traits/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ public function translation(): HasOne
{
return $this
->hasOne($this->getTranslationModelName(), $this->getTranslationRelationKey())
->where('locale', $this->localeOrFallback());
->where($this->getLocaleKey(), $this->localeOrFallback());
}

private function localeOrFallback()
{
return $this->useFallback() && ! $this->translations()->where('locale', $this->locale())->exists()
return $this->useFallback() && ! $this->translations()->where($this->getLocaleKey(), $this->locale())->exists()
? $this->getFallbackLocale()
: $this->locale();
}
Expand Down

0 comments on commit 4ce199d

Please sign in to comment.