vendredi 22 janvier 2021

How can I search encrypted data in Laravel using like operator

How can I search data in Laravel using like operator, I have used

encrypt($searchValue); 

OR

Crypt::encryptString($searchValue)

But both return full encrypted data but I need searchable data using like operator, In that case, the first name is the encrypted format when is search normal text it returns null


User::where('first_name', 'like', '%' . 'abc' . '%')->get();
//it's return null

When I user

//searchValue is like only 'ab'
User::where('first_name', 'like', '%' . Crypt::encryptString($searchValue) . '%')->get();
//it's also return null 

if anyone has known the solution kindly share the solution



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3iAjWrf
via IFTTT

Aucun commentaire:

Enregistrer un commentaire