Use whereRaw with parameter binding to sanitize your whereRaw statement:
$term = strtolower($vars['language']);
Item::whereRaw('lower(language) like (?)',["%{$term}%"])->get();
Prev answer
In some dabases you can use operator ilike
in your where. For example
Item::where('language', 'ilike', $vars['language'])->get();
All available operators are:
protected $operators = array(
'=', '<', '>', '<=', '>=', '<>', '!=',
'like', 'not like', 'between', 'ilike',
'&', '|', '^', '<<', '>>',
);
Edit: ilike
is case-insensitive like
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…