传递给 Illuminate\Database\Query\Builder::cleanBindings() 的参数 1 必须是数组类型,给定的字符串,在错误中调用但我传递数组

Argument 1 passed to Illuminate\Database\Query\Builder::cleanBindings() must be of the type array, string given, called in Error but i pass array

当我尝试使用 whereIn 在 laravel 中获取 posts 时,出现此错误:

Argument 1 passed to Illuminate\Database\Query\Builder::cleanBindings() must be of the type array, string given, called in

但我将参数作为数组传递,下面我将 post 代码,在此先感谢。

$arrayRecived = json_decode($request->fallowList);
var_dump($arrayRecived);
$result = DB::table('posts')->leftJoin('post_votes', function($join) {
    $recived = auth()->userOrFail();
    $join->on('posts.id', '=', 'post_votes.post_id')->where('post_votes.user_id', '=', $recived['id']);
})->select('posts.id', 'posts.user_id', 'posts.description', 'vote', 'posts.votes', 'posts.filename')
->whereIn('posts.user_id', '=', $arrayRecived)
->orderBy('posts.id', 'desc')->get();

return response()->json(['posts' => $result], 200);

如果我在 $arrayRecived 上执行 var_dump() 在我执行 json_decode() 之后它说是一个数组并且在控制台中是这样的:

array(2) {
  [0]=>
  int(3)
  [1]=>
  int(9)
}

whereIn() 只接受 2 个参数,其中第二个是数组。因此,以下更改应该可以使它起作用。

->whereIn('posts.user_id', $arrayRecived)

奖金,如果你想做 != 等效,它应该是。

->whereIn('posts.user_id', $arrayRecived, 'and', true)