fix filtering with operator not like issue

parent f3f230a9
...@@ -978,9 +978,13 @@ class Builder extends BaseBuilder ...@@ -978,9 +978,13 @@ class Builder extends BaseBuilder
{ {
extract($where); extract($where);
// Replace like with a Regex instance. // Replace like or not like with a Regex instance.
if ($operator == 'like') { if (in_array($operator, ['like', 'not like'])) {
if (Str::startsWith($operator, 'not')) {
$operator = 'not';
} else {
$operator = '='; $operator = '=';
}
// Convert to regular expression. // Convert to regular expression.
$regex = preg_replace('#(^|[^\\\])%#', '$1.*', preg_quote($value)); $regex = preg_replace('#(^|[^\\\])%#', '$1.*', preg_quote($value));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment