@@ -48,6 +48,15 @@ public function where($field, $op = null, $condition = null)
4848 $ param = func_get_args ();
4949 array_shift ($ param );
5050
51+ if (is_array ($ field ) && is_array ($ field [0 ])) {
52+ $ where = function ($ query ) use ($ field ) {
53+ foreach ($ field as $ item ) {
54+ $ query ->where ($ item [0 ], $ item [1 ], $ item [2 ]);
55+ }
56+ };
57+ $ logic = is_string ($ op ) && 'or ' == strtolower ($ op ) ? 'OR ' : 'AND ' ;
58+ return $ this ->parseWhereExp ($ logic , $ where , null , null );
59+ }
5160 return $ this ->parseWhereExp ('AND ' , $ field , $ op , $ condition , $ param );
5261 }
5362
@@ -91,6 +100,16 @@ public function whereOr($field, $op = null, $condition = null)
91100 $ param = func_get_args ();
92101 array_shift ($ param );
93102
103+ if (is_array ($ field ) && is_array ($ field [0 ])) {
104+ $ where = function ($ query ) use ($ field ) {
105+ foreach ($ field as $ item ) {
106+ $ query ->whereOr ($ item [0 ], $ item [1 ], $ item [2 ]);
107+ }
108+ };
109+ $ logic = is_string ($ op ) && 'or ' == strtolower ($ op ) ? 'OR ' : 'AND ' ;
110+ return $ this ->parseWhereExp ($ logic , $ where , null , null );
111+ }
112+
94113 return $ this ->parseWhereExp ('OR ' , $ field , $ op , $ condition , $ param );
95114 }
96115
0 commit comments