samedi 23 mars 2019

Lower case in where clause

In my Laravel 5, I have this query

Menu::where('slug', '=', $slug)->count();

I'm trying to change slug in the DB to lowercase to match the sting in $slug.

I changed the query above to this,

Menu::where('LOWER(`slug`)', '=', $slug)->count();

and got this error

Column not found: 1054 Unknown column 'LOWER(`slug`)' in 'where clause'

Any idea how to resolve this? Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire