Answer the question
In order to leave comments, you need to log in
Is it possible to register a new operator for Query Builder in Laravel?
Good day.
I use Laravel + PostgreSQL, and it became necessary to make a case-insensitive comparison of column values with any of the array values. The ILIKE ANY binding is great for this, but Laravel does not treat it as an operator.
$query->where('data', 'ilike', $keywords); // <--- все супер
// думает, что ilike any - это значение и начинает сравнивать с ним
$query->where('data', 'ilike any', $keywords); // <--- $keywords игнорируются
Answer the question
In order to leave comments, you need to log in
What is the problem with using whereRaw? There you can use ?-bindings and not be afraid of injections.
You can try like this
Registration of their operators is not provided, as far as I know.
Can. Use mixins: *poke*
After that, write in the @method vendor in the dockblock. Yes, the solution is very far from ideal, but we have what we have :/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question