public function scopeWhereHasMedia(Builder $q, $tags, $match_all = false)
{
if ($match_all && is_array($tags) && count($tags) > 1) {
return $this->scopeWhereHasMediaMatchAll($q, $tags);
}
$q->whereHas('media', function (Builder $q) use($tags) {
$q->whereIn('tag', (array) $tags);
});
}