I have a query like following and wants to set all Customer with building areas < 500 building_areas on end of my list.
My not working query:
$Customers = Customer::query()->orderBy('id','DESC') ->orderByRaw('(building_areas < 500)','DESC');
How to use Laravels orderByRaw in this case?
Here is my solution if anybody wants to know:
$Customers = Customer::query()->orderByRaw('building_areas >= 500') ->orderBy('id','DESC');
2.1m questions
2.1m answers
60 comments
57.0k users