I am facing a problem where I tried to query set of data from database using Laravel 7. Below is my code, I tried to use ILIKE but the browser return an error, how can I fix this? or any other ways that I can use?
$hawker = Hawker::withTrashed();
if($request->name){
$hawker = $hawker->where('name', 'ILIKE', '%'.$request->name.'%');
}
$hawker = $hawker->paginate($request->sizePerPage);
return response()->json($hawker, Response::HTTP_OK);
The query just to ignore any uppercase or lowercase whether if the data in database example like 'Chicken', but my query is chicken , it will still return the data