A requirement of an application I am making is that all user data (emails, addresses, date of birth, etc...) be encrypted. So, I use a trait like the one found here. This, however, brings up an issue when querying the data like below.
$user = User::where(“email”, “=“, $email);
Since I am searching encrypted data, the above query will not work as intended.
A rather naive solution I thought of is to decrypt the entire dataset before querying like so
$data = User::all();
$cnt = count($data)
for($i=0; $i<$cnt; $i++){// decrypt record i}
But this is very impractical and expensive. Is there a better solution to this problem?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire