Hello, so I am defining a relationship with a user and the core database where all entries are encrypted. For this I have assigned an encrypted key to each user so that using the eloquent query I can find out which row belongs to which user.
I am using the encryptable trait which automatically decrypts the key on call. But however for some reason it is not decrypting it in the eloquent query. Obviously, now there's something wrong with my code here. Is there a way out of this or any alternative?
However, it's the 'key' ie the first parameter in the query I want to decrypt to match the results. It doesn't get decrypted in the eloquent query I guess?
In Model key is encrypted, in User it's also encrypted, but you use trait where when you call it it will be automatically decrypts. So you have to encrypt it again.
& it will get me the row which has the same key when decrypted.
But I cannot do that because Crypt::decrypt('key') is not a valid parameter and it will not search the column. The Crypt Facade will give me a "Low Payload" error.
Since laravel encryptions are randomized and it is not suggested to use the same encrypted string two places.