public function scopeIsNotTagged(Builder $query): Builder
    {
        $alias = $this->taggableCreateNewAlias(__FUNCTION__);
        $morphForeignKeyName = $this->getQualifiedForeignPivotKeyNameWithAlias($alias);

        return $this->prepareTableJoin($query, 'left', $alias)
            ->havingRaw("COUNT(DISTINCT {$morphForeignKeyName}) = 0");
    }
public function scopeIsNotTagged(Builder $query): Builder
    {
        $alias = $this->taggableCreateNewAlias(__FUNCTION__);
        $morphForeignKeyName = $this->getQualifiedForeignPivotKeyNameWithAlias($alias);

        return $this->prepareTableJoin($query, 'left', $alias)
            ->havingRaw("COUNT(DISTINCT {$morphForeignKeyName}) = 0");
    }
public function scopeIsNotTagged ( Builder $ query ) : Builder { $ alias = $ this -> taggableCreateNewAlias ( __FUNCTION__ ) ; $ morphForeignKeyName = $ this -> getQualifiedForeignPivotKeyNameWithAlias ( $ alias ) ; return $ this -> prepareTableJoin ( $ query , 'left' , $ alias ) -> havingRaw ( "COUNT(DISTINCT {$morphForeignKeyName}) = 0" ) ; }
Query scope for models that does not have have any tags.

@param Builder $query

@return Builder
Query scope for models that does not have have any tags .