How to solve Type error: Argument 1 passed to Rinvex\Repository\Repositories\EloquentRepository::findWhereNotIn() must be of the type array?

How to solve Type error: Argument 1 passed to Rinvex\Repository\Repositories\EloquentRepository::findWhereNotIn() must be of the type array?

我的查询是这样的:

$this->user_repository->findWhereNotIn('id', [1, 2, 3, 4]);

执行时出现如下错误:

[Symfony\Component\Debug\Exception\FatalThrowableError] Type error: Argument 1 passed to Rinvex\Repository\Repositories\EloquentRepository::findWhereNotIn() must be of the type array, string given, called in C:\xampp\htdocs\myshop\app\Console\Commands\Check.php on line 48

而在教程 https://github.com/rinvex/repository#findwherenotin 中,我的查询似乎是正确的

我该如何解决?

您在第一个参数中将列名作为字符串传递,然后在第二个参数中将值作为数组传递,而 rinvex/repository findWhereNotIn [=12 的正确语法=] 将列名和值作为关联数组传递给第一个参数,如下所示:

$repository->findWhereNotIn(['id', [1, 2, 5, 8]]);

注意他们是如何通过的:['id', [1, 2, 5, 8]]