1 year ago

Writing a SQL Query into Eloquent

Posted 1 year ago by bobmyles

I have a query as below, I am struggling to write it into Eloquent,

SELECT id, description FROM turnovers ORDER BY CASE WHEN id = (SELECT MAX(id) FROM turnovers) THEN 0 ELSE 1 END, id;

The model is Turnover.

Any help is appreciated.

Please sign in or create an account to participate in this conversation.