Skip to content

Commit

Permalink
Merge pull request #297 from quintenbuis/main
Browse files Browse the repository at this point in the history
Change relation() to use the new ofMany
  • Loading branch information
Gummibeer authored Oct 10, 2022
2 parents 3558afd + aa355da commit 2a7e74a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Translatable/Traits/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ public function translation(): HasOne
{
return $this
->hasOne($this->getTranslationModelName(), $this->getTranslationRelationKey())
->where($this->getLocaleKey(), $this->localeOrFallback());
->ofMany([
$this->getTranslationRelationKey() => 'max',
], function ($query) {
$query->where($this->getLocaleKey(), $this->localeOrFallback());
});
}

protected function localeOrFallback()
Expand Down

0 comments on commit 2a7e74a

Please sign in to comment.