I would like to know how can I ignore the accent in multiple search with eloquent from Laravel.
Currently I have this :
// $searchTerms => 'Héllo human';
$explodedTerms = explode(" ", $searchTerms);
...
// $explodedTerms => ['Héllo', 'human'];
$query->where(function ($q) use ($explodedTerms) {
foreach ($explodedTerms as $value) {
$q->whereRaw('LOWER(`text`) LIKE ?', ['%'.strtolower($value).'%' ]);
}
});
...
I would like to have the search terms 'hello human' to match the field text.
I tried with ILIKE but I have an error :
$q->whereRaw('LOWER(`text`) ILIKE ?', ['%'.strtolower($value).'%' ]);
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ILIKE