src/Mediable.php
public function loadMedia($tags = [], $match_all = false)
    {
        $tags = (array) $tags;

        if (empty($tags)) {
            return $this->load('media');
        }

        if ($match_all) {
            return $this->loadMediaMatchAll($tags);
        }

        $this->load(['media' => function (MorphToMany $q) use ($tags) {
            $this->wherePivotTagIn($q, $tags);
        }]);

        return $this;
    }
public function loadMedia($tags = [], $match_all = false)
    {
        $tags = (array) $tags;

        if (empty($tags)) {
            return $this->load('media');
        }

        if ($match_all) {
            return $this->loadMediaMatchAll($tags);
        }

        $this->load(['media' => function (MorphToMany $q) use ($tags) {
            $this->wherePivotTagIn($q, $tags);
        }]);

        return $this;
    }
public function loadMedia ( $ tags = [ ] , $ match_all = false ) { $ tags = ( array ) $ tags ; if ( empty ( $ tags ) ) { return $ this -> load ( 'media' ) ; } if ( $ match_all ) { return $ this -> loadMediaMatchAll ( $ tags ) ; } $ this -> load ( [ 'media' => function ( MorphToMany $ q ) use ( $ tags ) { $ this -> wherePivotTagIn ( $ q , $ tags ) ; } ] ) ; return $ this ; }
Lazy eager load attached media relationships.
@param  string|string[] $tags      If one or more tags are specified, only media attached to those tags will be loaded.
@param  bool            $match_all Only load media matching all provided tags
@return $this
Lazy eager load attached media relationships .