Skip to content

Commit 0b91067

Browse files
authored
fix null field
Illuminate\Contracts\Encryption\DecryptException: The payload is invalid. #0 /xxx/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php(136): Illuminate\Encryption\Encrypter->getJsonPayload(NULL) #1 /xxx/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Encryption\Encrypter->decrypt(NULL) #2 /xxx/app/Models/EncryptableDbAttribute.php(152): Illuminate\Support\Facades\Facade::__callStatic('decrypt', Array)
1 parent 34d9bbe commit 0b91067

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Traits/EncryptableDbAttribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getAttributeValue($key)
3030
}
3131

3232
// decrypt value before casts
33-
if (in_array($key, $this->encryptable)) {
33+
if (in_array($key, $this->encryptable) && !is_null($value) && $value !== '') {
3434
$value = $this->decrypt($value);
3535
}
3636

0 commit comments

Comments
 (0)