0

我的查询是这样的:

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

执行时,存在如下错误:

[Symfony\Component\Debug\Exception\FatalThrowableError] 类型错误:传递给 Rinvex\Repository\Repositories\EloquentRepository::findWhereNotIn() 的参数 1 必须是数组类型,给定字符串,在 C:\xampp\htdocs\myshop 中调用第 48 行的 \app\Console\Commands\Check.php

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

我该如何解决?

4

1 回答 1

2

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

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

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

于 2017-03-04T17:36:38.313 回答