Skip to content

Commit 6275878

Browse files
authored
fix: Fixing issue when using a different table to store pivot data (spatie#492)
1 parent d6cf267 commit 6275878

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/HasTags.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static function bootHasTags()
5757
public function tags(): MorphToMany
5858
{
5959
return $this
60-
->morphToMany(self::getTagClassName(), $this->getTaggableMorphName())
60+
->morphToMany(self::getTagClassName(), $this->getTaggableMorphName(), $this->getTaggableTableName())
6161
->using($this->getPivotModelClassName())
6262
->ordered();
6363
}
@@ -67,7 +67,7 @@ public function tagsTranslated(string | null $locale = null): MorphToMany
6767
$locale = ! is_null($locale) ? $locale : self::getTagClassName()::getLocale();
6868

6969
return $this
70-
->morphToMany(self::getTagClassName(), $this->getTaggableMorphName())
70+
->morphToMany(self::getTagClassName(), $this->getTaggableMorphName(), $this->getTaggableTableName())
7171
->using($this->getPivotModelClassName())
7272
->select('*')
7373
->selectRaw("JSON_UNQUOTE(JSON_EXTRACT(name, '$.\"{$locale}\"')) as name_translated")

0 commit comments

Comments
 (0)