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

@param  object   $query
@param  integer  $taxonomy_id
@return mixed
Scope by category id .