Reputation: 57
I'm not able to use the pgsql extension unaccent while trying to retrieve records from a database.
I set up a dynamic search in my application that sends, with Ajax, what the user types in a field, and also what field was selected. I replace every accent in the string with a javascript function before sending it to my controller.
My problem is that I don't know how to make postgre understand that it should ignore accents.
I tried to use Eloquent's whereRaw to use the unaccent (that I activated) function, with no success.
->whereRaw("unaccent(".$request->field.") ILIKE '".$request->search."'")
Upvotes: 2
Views: 2510
Reputation: 21
Open PostgreSQL, select database and do this command:
CREATE EXTENSION unaccent;
$query->whereRaw("unaccent(".$request->field.") ilike unaccent('%".$request->search."%')");
Upvotes: 2