【发布时间】:2020-05-20 07:41:54
【问题描述】:
我正在尝试在一个集合上使用 findmany(),我用这个检查了它是否是一个集合:
if ($join instanceof Collection) {
log::info("deemed collection");
}else{
log::info("not deemed collection");
}
虽然它似乎是一个集合,但我仍然收到错误:
BadMethodCallException
Method Illuminate\Database\Eloquent\Collection::findmany does not exist.
当我尝试对其使用 findmany() 时,如下所示:
$join = $join->findmany(1);
$join 是这样创建的:
$join = coretable::with($permittedTables)->get();
其中$permittedTables 是一个表名数组,因此该集合可以包含任意数量的表和表的组合。
为什么我不能使用这个集合中的 findmany() 方法?它应该可以从集合中访问,不是吗?
【问题讨论】:
标签: php laravel eloquent lumen