diff --git a/src/Taggable.php b/src/Taggable.php index 2408f86..652b1c3 100644 --- a/src/Taggable.php +++ b/src/Taggable.php @@ -205,7 +205,8 @@ public function scopeWithAllTags(Builder $query, $tagNames): Builder ->where('tag_slug', TaggingUtility::normalize($tagSlug)) ->where('taggable_type', $className) ->get() - ->pluck('taggable_id'); + ->pluck('taggable_id') + ->unique(); $primaryKey = $this->getKeyName(); $query->whereIn($this->getTable().'.'.$primaryKey, $tags); @@ -401,7 +402,8 @@ private function assembleTagsForScoping($query, $tagNames) ->whereIn('tag_slug', $tagNames) ->where('taggable_type', $className) ->get() - ->pluck('taggable_id'); + ->pluck('taggable_id') + ->unique(); return $tags; }