src/Traits/HasTaxonomies.php
public function scopeHasCategories($query, $taxonomy_ids)
    {
        return $query->whereHas('taxed', function($q) use($taxonomy_ids) {
            $q->whereIn('taxonomy_id', $taxonomy_ids);
        });
    }
public function scopeHasCategories($query, $taxonomy_ids)
    {
        return $query->whereHas('taxed', function($q) use($taxonomy_ids) {
            $q->whereIn('taxonomy_id', $taxonomy_ids);
        });
    }
public function scopeHasCategories ( $ query , $ taxonomy_ids ) { return $ query -> whereHas ( 'taxed' , function ( $ q ) use ( $ taxonomy_ids ) { $ q -> whereIn ( 'taxonomy_id' , $ taxonomy_ids ) ; } ) ; }
Scope by category ids.

@param  object  $query
@param  array   $taxonomy_ids
@return mixed
Scope by category ids .