src/Mediable.php
public function scopeWhereHasMediaMatchAll(Builder $q, array $tags)
    {
        $grammar = $q->getQuery()->getGrammar();
        $subquery = $this->newMatchAllQuery($tags)
            ->selectRaw('count(*)')
            ->whereRaw($grammar->wrap($this->mediaQualifiedForeignKey()).' = '.$grammar->wrap($this->getQualifiedKeyName()));
        $q->whereRaw('('.$subquery->toSql().') >= 1', $subquery->getBindings());
    }
public function scopeWhereHasMediaMatchAll(Builder $q, array $tags)
    {
        $grammar = $q->getQuery()->getGrammar();
        $subquery = $this->newMatchAllQuery($tags)
            ->selectRaw('count(*)')
            ->whereRaw($grammar->wrap($this->mediaQualifiedForeignKey()).' = '.$grammar->wrap($this->getQualifiedKeyName()));
        $q->whereRaw('('.$subquery->toSql().') >= 1', $subquery->getBindings());
    }
public function scopeWhereHasMediaMatchAll ( Builder $ q , array $ tags ) { $ grammar = $ q -> getQuery ( ) -> getGrammar ( ) ; $ subquery = $ this -> newMatchAllQuery ( $ tags ) -> selectRaw ( 'count(*)' ) -> whereRaw ( $ grammar -> wrap ( $ this -> mediaQualifiedForeignKey ( ) ) . ' = ' . $ grammar -> wrap ( $ this -> getQualifiedKeyName ( ) ) ) ; $ q -> whereRaw ( '(' . $ subquery -> toSql ( ) . ') >= 1' , $ subquery -> getBindings ( ) ) ; }
Query scope to detect the presence of one or more attached media that is bound to all of the specified tags simultaneously.
@param  \Illuminate\Database\Eloquent\Builder $q
@param  string[]                              $tags
@return void
Query scope to detect the presence of one or more attached media that is bound to all of the specified tags simultaneously .