src/Mediable.php
protected function addMatchAllToEagerLoadQuery(MorphToMany $q, $tags = [])
    {
        $tags = (array) $tags;
        $grammar = $q->getBaseQuery()->getGrammar();
        $subquery = $this->newMatchAllQuery($tags)->select($this->mediaQualifiedRelatedKey());
        $q->whereRaw($grammar->wrap($this->mediaQualifiedRelatedKey()).' IN ('.$subquery->toSql().')', $subquery->getBindings());
        $this->wherePivotTagIn($q, $tags);
    }
protected function addMatchAllToEagerLoadQuery(MorphToMany $q, $tags = [])
    {
        $tags = (array) $tags;
        $grammar = $q->getBaseQuery()->getGrammar();
        $subquery = $this->newMatchAllQuery($tags)->select($this->mediaQualifiedRelatedKey());
        $q->whereRaw($grammar->wrap($this->mediaQualifiedRelatedKey()).' IN ('.$subquery->toSql().')', $subquery->getBindings());
        $this->wherePivotTagIn($q, $tags);
    }
protected function addMatchAllToEagerLoadQuery ( MorphToMany $ q , $ tags = [ ] ) { $ tags = ( array ) $ tags ; $ grammar = $ q -> getBaseQuery ( ) -> getGrammar ( ) ; $ subquery = $ this -> newMatchAllQuery ( $ tags ) -> select ( $ this -> mediaQualifiedRelatedKey ( ) ) ; $ q -> whereRaw ( $ grammar -> wrap ( $ this -> mediaQualifiedRelatedKey ( ) ) . ' IN (' . $ subquery -> toSql ( ) . ')' , $ subquery -> getBindings ( ) ) ; $ this -> wherePivotTagIn ( $ q , $ tags ) ; }
Modify an eager load query to only load media assigned to all provided tags simultaneously.
@param  \Illuminate\Database\Eloquent\Relations\MorphToMany $q
@param  string|string[]                                     $tags
@return void
Modify an eager load query to only load media assigned to all provided tags simultaneously .