Skip to content

Commit 2a7e74a

Browse files
authored
Merge pull request #297 from quintenbuis/main
Change relation() to use the new ofMany
2 parents 3558afd + aa355da commit 2a7e74a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Translatable/Traits/Relationship.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ public function translation(): HasOne
6565
{
6666
return $this
6767
->hasOne($this->getTranslationModelName(), $this->getTranslationRelationKey())
68-
->where($this->getLocaleKey(), $this->localeOrFallback());
68+
->ofMany([
69+
$this->getTranslationRelationKey() => 'max',
70+
], function ($query) {
71+
$query->where($this->getLocaleKey(), $this->localeOrFallback());
72+
});
6973
}
7074

7175
protected function localeOrFallback()

0 commit comments

Comments
 (0)