protected function eagerlyOneToMany($model, $where, $relation, $subRelation = '', $closure = false)
{
$foreignKey = $this->foreignKey;
// 预载入关联查询 支持嵌套预载入
if ($closure) {
call_user_func_array($closure, [&$model]);
}
$list = $model->where($where)->with($subRelation)->select();
// 组装模型数据
$data = [];
foreach ($list as $set) {
$data[$set->{$foreignKey}][] = $set;
}
return $data;
}