You can't just insert the SQL, you need to escape it. Something like:
orderBy(DB::raw(ABS(DATEDIFF('auction.start_date', NOW()))))->
That gives me a error
Call to undefined function DATEDIFF()
The funny thing is when I did
orderBy(ABS(DATEDIFF('auction.start_date', NOW())))->
I didn't get an error, it just didn't load
How about
orderBy(DB::raw('ABS(DATEDIFF(auction.start_date, NOW()))'))->
Add quotes around everything going into DB::raw and remove the quotes around auction.start_date... should work fingers crossed.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community