Plank\Mediable\Mediable::scopeWhereHasMedia PHP Метод

scopeWhereHasMedia() публичный Метод

Query scope to detect the presence of one or more attached media for a given tag.
public scopeWhereHasMedia ( Builder $q, string | array $tags, boolean $match_all = false ) : void
$q Illuminate\Database\Eloquent\Builder
$tags string | array
$match_all boolean
Результат void
    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);
        });
    }