Skip to content

Commit

Permalink
Merge pull request #110 from Temepest74/2.0
Browse files Browse the repository at this point in the history
added optional operator to whereMeta
  • Loading branch information
kodeine authored Feb 14, 2024
2 parents fcdfb7b + a88fed7 commit 6134a25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Kodeine/Metable/Metable.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ trait Metable
* whereMeta scope for easier join
* -------------------------
*/
public function scopeWhereMeta($query, $key, $value, $alias = null) {
public function scopeWhereMeta($query, $key, $value, $alias = null, $operator = '=') {
$alias = (empty( $alias )) ? $this->getMetaTable() : $alias;
return $query->join( $this->getMetaTable() . ' AS ' . $alias, $this->getQualifiedKeyName(), '=', $alias . '.' . $this->getMetaKeyName() )->where( $alias . '.key', '=', $key )->where( $alias . '.value', '=', $value )->select( $this->getTable() . '.*' );
return $query->join( $this->getMetaTable() . ' AS ' . $alias, $this->getQualifiedKeyName(), '=', $alias . '.' . $this->getMetaKeyName() )->where( $alias . '.key', '=', $key )->where( $alias . '.value', $operator, $value )->select( $this->getTable() . '.*' );
}

/**
Expand Down

0 comments on commit 6134a25

Please sign in to comment.