@@ -77,12 +77,16 @@ class Builder extends BaseBuilder
77
77
'like ' ,
78
78
'not like ' ,
79
79
'between ' ,
80
+ 'ilike ' ,
81
+ 'not ilike ' ,
80
82
'& ' ,
81
83
'| ' ,
82
84
'^ ' ,
83
85
'<< ' ,
84
86
'>> ' ,
85
87
'rlike ' ,
88
+ 'regexp ' ,
89
+ 'not regexp ' ,
86
90
'exists ' ,
87
91
'type ' ,
88
92
'mod ' ,
@@ -113,7 +117,6 @@ class Builder extends BaseBuilder
113
117
* @var array
114
118
*/
115
119
protected $ conversion = [
116
- '= ' => '= ' ,
117
120
'!= ' => 'ne ' ,
118
121
'<> ' => 'ne ' ,
119
122
'< ' => 'lt ' ,
@@ -1068,6 +1071,7 @@ protected function compileWhereBasic(array $where): array
1068
1071
throw new \LogicException (sprintf ('Missing expected starting delimiter in regular expression "%s", supported delimiters are: %s ' , $ value , implode (' ' , self ::REGEX_DELIMITERS )));
1069
1072
}
1070
1073
$ e = explode ($ delimiter , $ value );
1074
+ // We don't try to detect if the last delimiter is escaped. This would be an invalid regex.
1071
1075
if (count ($ e ) < 3 ) {
1072
1076
throw new \LogicException (sprintf ('Missing expected ending delimiter "%s" in regular expression "%s" ' , $ delimiter , $ value ));
1073
1077
}
@@ -1078,7 +1082,7 @@ protected function compileWhereBasic(array $where): array
1078
1082
$ value = new Regex ($ regstr , $ flags );
1079
1083
}
1080
1084
1081
- // For inverse regex operations, we can just use the $not operatorwith the Regex
1085
+ // For inverse regex operations, we can just use the $not operator with the Regex
1082
1086
$ operator = $ operator === 'regex ' ? '= ' : 'not ' ;
1083
1087
}
1084
1088
@@ -1260,21 +1264,6 @@ protected function compileWhereRaw(array $where): mixed
1260
1264
return $ where ['sql ' ];
1261
1265
}
1262
1266
1263
- protected function invalidOperator ($ operator )
1264
- {
1265
- if (! is_string ($ operator )) {
1266
- return true ;
1267
- }
1268
-
1269
- $ operator = strtolower ($ operator );
1270
-
1271
- if (isset ($ this ->conversion [$ operator ])) {
1272
- return false ;
1273
- }
1274
-
1275
- return parent ::invalidOperator ($ operator );
1276
- }
1277
-
1278
1267
/**
1279
1268
* Set custom options for the query.
1280
1269
*
0 commit comments