We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2222e6c commit 0040822Copy full SHA for 0040822
src/HasEncryptedAttributes.php
@@ -2,6 +2,8 @@
2
3
namespace Buildcode\LaravelDatabaseEmails;
4
5
+use Illuminate\Contracts\Encryption\DecryptException;
6
+
7
trait HasEncryptedAttributes
8
{
9
/**
@@ -41,7 +43,11 @@ public function getAttribute($key)
41
43
$value = $this->attributes[$key];
42
44
45
if ($this->isEncrypted() && in_array($key, $this->encrypted)) {
- $value = decrypt($value);
46
+ try {
47
+ $value = decrypt($value);
48
+ } catch (DecryptException $e) {
49
+ $value = '';
50
+ }
51
}
52
53
if (in_array($key, $this->encoded) && is_string($value)) {
0 commit comments