Skip to content

Commit

Permalink
fix: Fixing issue when using a different table to store pivot data (#492
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jordanmiguel committed Jan 19, 2024
1 parent d6cf267 commit 6275878
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/HasTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function bootHasTags()
public function tags(): MorphToMany
{
return $this
->morphToMany(self::getTagClassName(), $this->getTaggableMorphName())
->morphToMany(self::getTagClassName(), $this->getTaggableMorphName(), $this->getTaggableTableName())
->using($this->getPivotModelClassName())
->ordered();
}
Expand All @@ -67,7 +67,7 @@ public function tagsTranslated(string | null $locale = null): MorphToMany
$locale = ! is_null($locale) ? $locale : self::getTagClassName()::getLocale();

return $this
->morphToMany(self::getTagClassName(), $this->getTaggableMorphName())
->morphToMany(self::getTagClassName(), $this->getTaggableMorphName(), $this->getTaggableTableName())
->using($this->getPivotModelClassName())
->select('*')
->selectRaw("JSON_UNQUOTE(JSON_EXTRACT(name, '$.\"{$locale}\"')) as name_translated")
Expand Down

0 comments on commit 6275878

Please sign in to comment.