src/Models/Post.php
/**
     * Exclude posts when attached to tag.
     */
Exclude posts when attached to tag.
Exclude posts when attached to tag .
public function scopeExcludeByTag(Builder $query, int ...$ids): Builder
    {
        return $query->whereDoesntHave('tags', function ($query) use ($ids) {
            $query->whereIn('id', $ids);
        });
    }
public function scopeExcludeByTag ( Builder $ query , int ... $ ids ) : Builder { return $ query -> whereDoesntHave ( 'tags' , function ( $ query ) use ( $ ids ) { $ query -> whereIn ( 'id' , $ ids ) ; } ) ; }
Exclude posts when attached to tag.
Exclude posts when attached to tag .