Skip to content

Commit 01dd31e

Browse files
committed
Merge pull request #2 from s3rajkarnikar/master
Accounting for already encrypted values when using update method
2 parents cf1f790 + 23324fd commit 01dd31e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Dtisgodsson/Elocrypt/ElocryptTrait.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,12 @@ public function update(Array $attributes = [])
7979
{
8080
try
8181
{
82-
$attributes[$key] = Crypt::encrypt($value);
82+
$decrypted = Crypt::decrypt($value);
83+
$attributes[$key] = $value;
8384
}
8485
catch(DecryptException $exception)
8586
{
86-
$attributes[$key] = $value;
87+
$attributes[$key] = Crypt::encrypt($value);
8788
}
8889
}
8990
}

0 commit comments

Comments
 (0)