我正在尝试更改集合。但错误已经在foorlooad上,即使没有内容错误apears
foreach ($request->values as $id => &$value) {
$values[1] = $this->repository->getById($request->id)->values[$id][1];
$values[2] = $this->repository->getById($request->id)->values[$id][2];
$values[3] = $this->repository->getById($request->id)->values[$id][3];
$values[4] = $this->repository->getById($request->id)->values[$id][4];
//dd($value);
}
答案 0 :(得分:0)
我重构了我的代码来做dame但是使用了一个新数组而不是填充现有的$ request
foreach ($request->values as $id => $value) {
$values[$id][0] = $request->values[$id][0];
for ($i = 1; $i <= 4; $i++) {
if (isset($this->repository->getById($request->id)->values[$id][$i])) {
$values[$id][$i] = $this->repository->getById($request->id)->values[$id][$i];
} else {
$values[$id][$i] = '';
}
}
}