更新时间:2021-08-04 21:24:56
在一个地方使用$file_ids
,在其他地方使用$files_ids
,请确保使用相同的变量.
In one place you are using $file_ids
and in others $files_ids
so make sure you are using same variable.
此外,您确定在$file_ids
数组中有有效值吗?
In addition are you sure you have valid values in $file_ids
array?
看评论的问题是:
$downloadLink->file_ids = $file_ids;
inside makeDownloadLink
方法中.
inside makeDownloadLink
method.
您正在执行以下操作:
if (count($file_ids) > 1) {
$downloadLink->file_ids = implode(',', $file_ids);
}
$downloadLink->file_ids = $file_ids;
,当$file_ids
为数组时,这将失败.您应该像这样在此处添加else
:
and this will fail when $file_ids
is array. You should probably add else
here like so:
if (count($file_ids) > 1) {
$downloadLink->file_ids = implode(',', $file_ids);
}
else {
$downloadLink->file_ids = $file_ids;
}
类型错误:传递给BelongsToMany :: formatSyncList()的参数1必须为数组类型,给定为null,在
类型错误:传递给Doctrine\Common\Collections\ArrayCollection :: __ construct()的参数1必须为数组类型,给定对象
类型错误:传递给Illuminate \ Database \ Eloquent \ Builder :: create()的参数1必须为数组类型,给定null
传递给Illuminate \ Database \ Grammar :: parameterize()的参数1必须为数组类型,给定字符串
laravel类型错误:传递给Illuminate \ Database \ Eloquent \ Model :: save()的参数1必须为数组类型,给定对象