使用http://laravelsnippets.com/snippets/get-all-items-at-once-ordered-by-the-
current-order-of-ids-in-the-where-in-clause-
using中找到的解决方案-雄辩
$ids = array(1,17,2);$ids_ordered = implode(',', $ids);$items = static::whereIn('id', $ids) ->orderByRaw("FIELD(id, $ids_ordered)") ->get();
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)