Replies: 1 comment
-
This seems like a bug rather than an idea - maybe open an issue instead? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am current using
Model::encryptUsing()
to set a custom encrypter for eloquent so that I can use a different encryption key for eloquent data.The challenge is that it's only used for 'encrypted', 'encrypted:array', 'encrypted:collection', 'encrypted:json', 'encrypted:object' casts and not the AsEncryptedArrayObject, AsEncryptedCollection castables
I looked up the code and it seems like "expected behaviour" since the "encrypted:*" cast version first checks for the existence of a custom encrypter while the Castable classes don't
I am curious why the same logic is not used for both cases since;
It defeats the whole purpose of using a different encryption key for eloquent models since some casts will still use the global app key.
Makes your code less resilient since refactoring from a cast say "encrypted:array" to AsEncryptedArrayObject would simply break if one is using a custom encrypter.
Beta Was this translation helpful? Give feedback.
All reactions