$ids; // array of ids
$placeholders = implode(',',array_fill(0, count($ids), '?')); // string for the query
Operation::whereIn('id', $ids) ->orderByRaw("field(id,{$placeholders})", $ids)->get();
參考連結:stackoverflow.com/questions/261762...
本作品採用《CC 協議》,轉載必須註明作者和本文連結