public function hasTag($tags): bool
    {
        // Single tag slug
        if (is_string($tags)) {
            return $this->tags->contains('slug', $tags);
        }

        // Single tag id
        if (is_int($tags)) {
            return $this->tags->contains('id', $tags);
        }

        // Single tag model
        if ($tags instanceof Tag) {
            return $this->tags->contains('slug', $tags->slug);
        }

        // Array of tag slugs
        if (is_array($tags) && isset($tags[0]) && is_string($tags[0])) {
            return ! $this->tags->pluck('slug')->intersect($tags)->isEmpty();
        }

        // Array of tag ids
        if (is_array($tags) && isset($tags[0]) && is_int($tags[0])) {
            return ! $this->tags->pluck('id')->intersect($tags)->isEmpty();
        }

        // Collection of tag models
        if ($tags instanceof Collection) {
            return ! $tags->intersect($this->tags->pluck('slug'))->isEmpty();
        }

        return false;
    }
public function hasTag($tags): bool
    {
        // Single tag slug
        if (is_string($tags)) {
            return $this->tags->contains('slug', $tags);
        }

        // Single tag id
        if (is_int($tags)) {
            return $this->tags->contains('id', $tags);
        }

        // Single tag model
        if ($tags instanceof Tag) {
            return $this->tags->contains('slug', $tags->slug);
        }

        // Array of tag slugs
        if (is_array($tags) && isset($tags[0]) && is_string($tags[0])) {
            return ! $this->tags->pluck('slug')->intersect($tags)->isEmpty();
        }

        // Array of tag ids
        if (is_array($tags) && isset($tags[0]) && is_int($tags[0])) {
            return ! $this->tags->pluck('id')->intersect($tags)->isEmpty();
        }

        // Collection of tag models
        if ($tags instanceof Collection) {
            return ! $tags->intersect($this->tags->pluck('slug'))->isEmpty();
        }

        return false;
    }
public function hasTag ( $ tags ) : bool { // Single tag slug if ( is_string ( $ tags ) ) { return $ this -> tags -> contains ( 'slug' , $ tags ) ; } // Single tag id if ( is_int ( $ tags ) ) { return $ this -> tags -> contains ( 'id' , $ tags ) ; } // Single tag model if ( $ tags instanceof Tag ) { return $ this -> tags -> contains ( 'slug' , $ tags -> slug ) ; } // Array of tag slugs if ( is_array ( $ tags ) && isset ( $ tags [ 0 ] ) && is_string ( $ tags [ 0 ] ) ) { return ! $ this -> tags -> pluck ( 'slug' ) -> intersect ( $ tags ) -> isEmpty ( ) ; } // Array of tag ids if ( is_array ( $ tags ) && isset ( $ tags [ 0 ] ) && is_int ( $ tags [ 0 ] ) ) { return ! $ this -> tags -> pluck ( 'id' ) -> intersect ( $ tags ) -> isEmpty ( ) ; } // Collection of tag models if ( $ tags instanceof Collection ) { return ! $ tags -> intersect ( $ this -> tags -> pluck ( 'slug' ) ) -> isEmpty ( ) ; } return false ; }
Determine if the model has any the given tags.

@param int|string|array|\ArrayAccess|\Rinvex\Taggable\Tag $tags

@return bool
Determine if the model has any the given tags .