Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel postgresql case insensitive

I'm coding a web app using Laravel 4.1 and Postgresql as database. The db is case sensitive, but i'd like to make it case insensitive because, i.e., when a user is logging he should be able to access using upper case or lower case email address (like in every other website). However the column for the hash of the password must be case sensitive because the encryption method i use generates case sensitive strings.

I'm using Eloquen ORM of Laravel so i don't write queries directly.

How can i solve this problem?

Thanks in advance!

like image 902
Davide Mercurio Avatar asked Jan 24 '14 10:01

Davide Mercurio


1 Answers

A bit late, but this is pretty simple. Just use the "ILIKE" operator, e.g.

User::where("email", "ILIKE", $email)->get();
like image 171
joelennon Avatar answered Sep 29 '22 12:09

joelennon