Answer the question
In order to leave comments, you need to log in
Why doesn't Laravel's whereRaw support named placeholders like ::select?
I'd love to hear thoughts on the case, what is the reason for this. By understanding the real reason, you can design your code better.
Because you can get around this through the same ::select. But it’s not just that the developers removed such simple functionality.
Placeholders in the form ? in my opinion, they are very dangerous, since it is easy to make a mistake in the order of parameters in an array.
Answer the question
In order to leave comments, you need to log in
Welcome to Laravel. There is no real objective reason why they did this. Maybe they were too lazy, maybe they considered it unnecessary, maybe they don’t want to refactor and introduce such breaking changes.
Completely Supports
User::whereRaw('username = :username',[':username'=>'test'])->get();
'id =:id or something_else=:id'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question