From 0c693137c42d43aae9b2d4cadbd45c55d7f17904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E6=96=87=E5=81=A5?= Date: Sun, 16 Oct 2022 22:54:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `===`和`!==`查询表达式不支持判断`null`,因为360行判断`$value`为`null`时,会更改查询表达式为`=`。 为了方便查询`null`的值,增加`null`和`not null`表达式 --- src/Collection.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Collection.php b/src/Collection.php index 9d84e1a..6fdab23 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -401,6 +401,10 @@ public function where(string $field, $operator, $value = null) case 'not between': [$min, $max] = is_string($value) ? explode(',', $value) : $value; return is_scalar($result) && $result > $max || $result < $min; + case 'null': + return $result === null; + case 'not null': + return $result !== null; case '==': case '=': default: