I have several accessors set up to decrypt encrypted DB fields. However, I'm unable to search those fields unless I encrypt the search data first.
The thing is, I use Laravel Spark, and other third-party software which I'm unable to modify the code for obvious reasons. If I encrypt the "email" field on the "users" table, for instance, then certain things like logging in doesn't work anymore because of the fact that Laravel looks for an unencrypted email field using where().
As where() and other lookup methods (Ex. firstOrCreate()) already collect the column names, it'll be really simple to apply the same code that checks if a column has an accessor, and then if it does, just apply the mutator to the data before searching.
I have several accessors set up to decrypt encrypted DB fields. However, I'm unable to search those fields unless I encrypt the search data first.
The thing is, I use Laravel Spark, and other third-party software which I'm unable to modify the code for obvious reasons. If I encrypt the "email" field on the "users" table, for instance, then certain things like logging in doesn't work anymore because of the fact that Laravel looks for an unencrypted email field using
where()
.As
where()
and other lookup methods (Ex.firstOrCreate()
) already collect the column names, it'll be really simple to apply the same code that checks if a column has an accessor, and then if it does, just apply the mutator to the data before searching.