From 6e6c6e19ddc0220e9a0c2ef6a71ca0bf35de5c99 Mon Sep 17 00:00:00 2001 From: joycezhang <787027175@qq.com> Date: Sun, 13 Feb 2022 20:06:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Traits/EncryptTableDbAttribute.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Traits/EncryptTableDbAttribute.php b/src/Traits/EncryptTableDbAttribute.php index cd64e74..b77ebd5 100644 --- a/src/Traits/EncryptTableDbAttribute.php +++ b/src/Traits/EncryptTableDbAttribute.php @@ -19,7 +19,7 @@ trait EncryptTableDbAttribute */ public function setAttribute($key, $value) { - if (is_null($value) || !in_array($key, $this->encryptable)) { + if (is_null($value) || !in_array($key, $this->encryptTable)) { return parent::setAttribute($key, $value); } if ($this->isJsonCastable($key) && !is_null($value)) { @@ -47,7 +47,7 @@ public function getAttributeValue($key) } // 在强制转换前解密 - if (in_array($key, $this->encryptable) && !is_null($value) && $value !== '') { + if (in_array($key, $this->encryptTable) && !is_null($value) && $value !== '') { $value = $this->decrypt($value); } @@ -115,7 +115,7 @@ public function attributesToArray(): array private function decryptAttributes(array $attributes): array { foreach ($attributes as $key => $value) { - if (!in_array($key, $this->encryptable) || is_null($value) || $value === '') { + if (!in_array($key, $this->encryptTable) || is_null($value) || $value === '') { continue; }