From e6a780bcc473a9d4ed988cd22f59327ec5132323 Mon Sep 17 00:00:00 2001 From: 153264 <36463512+153264@users.noreply.github.com> Date: Sat, 16 Apr 2022 09:35:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20think\Validate=20unique?= =?UTF-8?q?=E8=A7=84=E5=88=99=20=E5=BD=93=E6=9C=AA=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=90=8D=E6=97=B6=20=E6=9C=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=A6=81=E9=AA=8C=E8=AF=81=E7=9A=84=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=90=8D=E8=BF=9B=E8=A1=8C=E6=9F=A5=E8=AF=A2=20=E5=AF=BC?= =?UTF-8?q?=E8=87=B4sql=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/think/Validate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/think/Validate.php b/src/think/Validate.php index 0788406415..0b28152e3f 100644 --- a/src/think/Validate.php +++ b/src/think/Validate.php @@ -1146,7 +1146,7 @@ public function unique($value, $rule, array $data = [], string $field = ''): boo } } } elseif (isset($data[$field])) { - $map[] = [$key, '=', $data[$field]]; + $map[] = [$key ?: $field, '=', $data[$field]]; } else { $map = []; }