src/Mediable.php
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);
        });
    }
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);
        });
    }
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 ) ; } ) ; }
Query scope to detect the presence of one or more attached media for a given tag.
@param  \Illuminate\Database\Eloquent\Builder $q
@param  string|string[]                       $tags
@param  bool                                  $match_all
@return void
Query scope to detect the presence of one or more attached media for a given tag .