Query Laravel Select WhereIn Array

Your Query is Here:-

$data = Post::select('id', 'name')
  ->whereIn('id', $order)
  ->orderByRaw(\DB::raw("FIELD(id, ".implode(",",$order).")"))
  ->get();

Remove [] from $order.

For WhereIn condition second parameter should be an array. So the $order should be

$order = [1,2,3,4]

If your $order is an array, i think that you should do this

whereIn('id', $order) instead of whereIn('id', [$order])

P.S. In official documentation mentioned that second argument should be an array:

$users = DB::table('users')
             ->whereIn('id', [1, 2, 3])
             ->get();