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');
1.4m articles
1.4m replys
5 comments
57.0k users