I am using SphinxSearch to query some contents and have the ids of my objects that I want to query with MySQL. The array of my ids are sorted depending on their rank Sphinx gives.
Thus, I would like to make a MySQL like so:
SELECT * FROM table WHERE id IN (1,17,2)
ORDER BY FIELD(id,1,17,2)
I know I can do:
Table::whereIn('id', $ids)->get();
But I can't get the order I had.
How can I do that in a proper way with Laravel ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…