src/AttachableTrait.php
public static function scopeWhereAttach(Builder $query, $attaches, $type = 'filename')
    {
        $attaches = (new static)->prepareAttaches($attaches);

        foreach ($attaches as $attach) {
            $query->whereHas('attaches', function ($query) use ($type, $attach) {
                $query->where($type, $attach);
            });
        }

        return $query;
    }
public static function scopeWhereAttach(Builder $query, $attaches, $type = 'filename')
    {
        $attaches = (new static)->prepareAttaches($attaches);

        foreach ($attaches as $attach) {
            $query->whereHas('attaches', function ($query) use ($type, $attach) {
                $query->where($type, $attach);
            });
        }

        return $query;
    }
{@inheritdoc}