lundi 26 juin 2017

orderBy case insensitive with Laravel

I'm using Eloquent (Laravel 5.4) and a postgreSQL database. I created a users table with a name string column. Running this code returns users ordered by name BUT the search is case-sensitive:

$users = \App\User::orderBy('name')->get();

This code returns something like:

Alix
Beatrice
Zorro
adam
bill

Is there a way to get this list case-insensitive. I would like to have something like:

adam
Alix
Beatrice
bill
Zorro

Is there a way to get a "case-insensitive order by" result ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire