diff --git a/src/db/concern/WhereQuery.php b/src/db/concern/WhereQuery.php index 19d044df..454a427b 100644 --- a/src/db/concern/WhereQuery.php +++ b/src/db/concern/WhereQuery.php @@ -48,6 +48,15 @@ public function where($field, $op = null, $condition = null) $param = func_get_args(); array_shift($param); + if (is_array($field) && is_array($field[0])) { + $where = function($query) use($field) { + foreach($field as $item) { + $query->where($item[0], $item[1], $item[2]); + } + }; + $logic = is_string($op) && 'or' == strtolower($op) ? 'OR' : 'AND'; + return $this->parseWhereExp($logic, $where, null, null); + } return $this->parseWhereExp('AND', $field, $op, $condition, $param); } @@ -91,6 +100,16 @@ public function whereOr($field, $op = null, $condition = null) $param = func_get_args(); array_shift($param); + if (is_array($field) && is_array($field[0])) { + $where = function($query) use($field) { + foreach($field as $item) { + $query->whereOr($item[0], $item[1], $item[2]); + } + }; + $logic = is_string($op) && 'or' == strtolower($op) ? 'OR' : 'AND'; + return $this->parseWhereExp($logic, $where, null, null); + } + return $this->parseWhereExp('OR', $field, $op, $condition, $param); }