Sometime we have records in users table with following name like "Adnan", "ADNAN" and "adnan". now you just need to get case sensitive name like if you search "Adnan" then it should only get that record. so that solution i will give you simple example and show you how to make case sensitive query using mysql BINARY in laravel. you can use this example in laravel 6, laravel 7, laravel 8 and laravel 9 version.
$users = User::select("id", "name", "email")
->where(DB::raw('BINARY `name`'), "Adnan")
->get();
Comments
Post a Comment