public function whereHas($relation, Closure $callback = null, $operator = '>=', $count = 1) { return $this->has($relation, $operator, $count, 'and', $callback); }
public static function scopeWithTag(Builder $query, $tags, $type = 'slug') { $tags = (new static())->prepareTags($tags); return $query->whereHas('tags', function ($query) use($type, $tags) { $query->whereIn($type, $tags); }); }