Skip to content

Commit 6134a25

Browse files
authored
Merge pull request #110 from Temepest74/2.0
added optional operator to whereMeta
2 parents fcdfb7b + a88fed7 commit 6134a25

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Kodeine/Metable/Metable.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ trait Metable
2222
* whereMeta scope for easier join
2323
* -------------------------
2424
*/
25-
public function scopeWhereMeta($query, $key, $value, $alias = null) {
25+
public function scopeWhereMeta($query, $key, $value, $alias = null, $operator = '=') {
2626
$alias = (empty( $alias )) ? $this->getMetaTable() : $alias;
27-
return $query->join( $this->getMetaTable() . ' AS ' . $alias, $this->getQualifiedKeyName(), '=', $alias . '.' . $this->getMetaKeyName() )->where( $alias . '.key', '=', $key )->where( $alias . '.value', '=', $value )->select( $this->getTable() . '.*' );
27+
return $query->join( $this->getMetaTable() . ' AS ' . $alias, $this->getQualifiedKeyName(), '=', $alias . '.' . $this->getMetaKeyName() )->where( $alias . '.key', '=', $key )->where( $alias . '.value', $operator, $value )->select( $this->getTable() . '.*' );
2828
}
2929

3030
/**

0 commit comments

Comments
 (0)