You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The value should be set without error. $model->fieldName should return a decrypted string. $model->getRawOriginal('fieldName') should return an encrypted string.
Description:
Models sometimes fail to set attributes because the
MongoDB\Laravel\Eloquent\Model::setAttribute
callscastAttribute
, which is intended to be called when going from database to PHP and not PHP to database.The main cast which has this issue is any of the encryption ones, the model will attempt to decrypt something which isn't encrypted.
I have started work on a PR to fix this, hopefully I can get it finished today/tomorrow.
Steps to reproduce
Illuminate\Contracts\Encryption\DecryptException: The payload is invalid.
Expected behaviour
The value should be set without error.
$model->fieldName
should return a decrypted string.$model->getRawOriginal('fieldName')
should return an encrypted string.Actual behaviour
Anything which calls setAttribute will error which includes calls to: make, create, update
Here is a working test which shows this issue: https://github.com/stubbo/laravel-mongodb/actions/runs/7462021749
The text was updated successfully, but these errors were encountered: