【发布时间】:2017-07-22 07:52:23
【问题描述】:
我的查询是这样的:
$this->user_repository->findWhereNotIn('id', [1, 2, 3, 4]);
执行时出现如下错误:
[Symfony\Component\Debug\Exception\FatalThrowableError] 类型 错误:参数 1 传递给 Rinvex\Repository\Repositories\EloquentRepository::findWhereNotIn() 必须是数组类型,给定字符串,调用 C:\xampp\htdocs\myshop\app\Console\Commands\Check.php 第 48 行
而在教程https://github.com/rinvex/repository#findwherenotin 中,看起来我的查询是正确的
我该如何解决?
【问题讨论】:
-
Argument 1指的是id不是数组 -
尝试改用
['id'] -
@Onix,它不起作用。存在错误:
[ErrorException] Invalid argument supplied for foreach() -
@Machavity,我改成这样:
$this->user_repository->findWhereNotIn(['id'], [1, 2, 3, 4]);,但它不起作用 -
不应该是
whereNotIn而不是findWhereNotIn吗? laravel.com/docs/5.4/queries#where-clauses
标签: php laravel repository laravel-5.3 laravel-eloquent