kodeine / laravel-meta

Fluent Meta Data for Eloquent Models, as if it is a property on your model
MIT License
400 stars 90 forks source link

Add optional operator parameter to scopeWhereMeta #109

Closed Temepest74 closed 9 months ago

Temepest74 commented 9 months ago

Something like

    public function scopeWhereMeta($query, $key, $value, $alias = null, $operator = '=')
    {
        $alias = (empty($alias)) ? $this->getMetaTable() : $alias;
        $opperator = 2;
        return $query->join($this->getMetaTable() . ' AS ' . $alias, $this->getQualifiedKeyName(), '=', $alias . '.' . $this->getMetaKeyName())->where($alias . '.key', '=', $key)->where($alias . '.value', $operator, $value)->select($this->getTable() . '.*');
    }

This will help massively when using whereMeta. If you are good with this change, i can try to make a PR

kodeine commented 9 months ago

Please submit PR and i will take a look. Thanks