@@ -47,15 +47,16 @@ public function where($field, $op = null, $condition = null)
47
47
$ this ->options ['key ' ] = is_null ($ condition ) ? $ op : $ condition ;
48
48
}
49
49
50
+ $ logic = 'AND ' ;
50
51
$ param = func_get_args ();
51
52
array_shift ($ param );
52
53
53
54
if (is_array ($ field ) && !empty ($ field ) && array_is_list ($ field )) {
54
- return $ this ->where (function ($ query ) use ($ param , $ condition , $ op , $ field ) {
55
- return $ query ->parseWhereExp (' AND ' , $ field , $ op , $ condition , $ param );
55
+ return $ this ->where (function ($ query ) use ($ param , $ condition , $ op , $ field, $ logic ) {
56
+ return $ query ->parseWhereExp ($ logic , $ field , $ op , $ condition , $ param );
56
57
});
57
58
}
58
- return $ this ->parseWhereExp (' AND ' , $ field , $ op , $ condition , $ param );
59
+ return $ this ->parseWhereExp ($ logic , $ field , $ op , $ condition , $ param );
59
60
}
60
61
61
62
/**
@@ -95,16 +96,17 @@ protected function parseQueryWhere(BaseQuery $query): void
95
96
*/
96
97
public function whereOr ($ field , $ op = null , $ condition = null )
97
98
{
99
+ $ logic = 'OR ' ;
98
100
$ param = func_get_args ();
99
101
array_shift ($ param );
100
102
101
103
if (is_array ($ field ) && !empty ($ field ) && array_is_list ($ field )) {
102
- return $ this ->where (function ($ query ) use ($ param , $ condition , $ op , $ field ) {
103
- return $ query ->parseWhereExp (' OR ' , $ field , $ op , $ condition , $ param );
104
+ return $ this ->where (function ($ query ) use ($ param , $ condition , $ op , $ field, $ logic ) {
105
+ return $ query ->parseWhereExp ($ logic , $ field , $ op , $ condition , $ param );
104
106
});
105
107
}
106
108
107
- return $ this ->parseWhereExp (' OR ' , $ field , $ op , $ condition , $ param );
109
+ return $ this ->parseWhereExp ($ logic , $ field , $ op , $ condition , $ param );
108
110
}
109
111
110
112
/**
@@ -118,15 +120,16 @@ public function whereOr($field, $op = null, $condition = null)
118
120
*/
119
121
public function whereXor ($ field , $ op = null , $ condition = null )
120
122
{
123
+ $ logic = 'XOR ' ;
121
124
$ param = func_get_args ();
122
125
array_shift ($ param );
123
126
124
127
if (is_array ($ field ) && !empty ($ field ) && array_is_list ($ field )) {
125
- return $ this ->where (function ($ query ) use ($ param , $ condition , $ op , $ field ) {
126
- return $ query ->parseWhereExp (' XOR ' , $ field , $ op , $ condition , $ param );
128
+ return $ this ->where (function ($ query ) use ($ param , $ condition , $ op , $ field, $ logic ) {
129
+ return $ query ->parseWhereExp ($ logic , $ field , $ op , $ condition , $ param );
127
130
});
128
131
}
129
- return $ this ->parseWhereExp (' XOR ' , $ field , $ op , $ condition , $ param );
132
+ return $ this ->parseWhereExp ($ logic , $ field , $ op , $ condition , $ param );
130
133
}
131
134
132
135
/**
0 commit comments