0
當我嘗試將多個記錄保存到數據庫中,我得到這個錯誤未定義抵消:2 laravel
未定義抵消:2
我的存儲控制器
public function store(Request $request)
{
$course = Course::create($request->all());
$lessons = $request->except(['_token','_method']);
for($x = 0;$x <= count($lessons); $x++)
{
$lesson = CourseClass::create([
'course_id' => $course->id,
'class_name' => $lessons['class_name'][$x],
'class_desc' => $lessons['class_desc'][$x],
'video' => $lessons['video'][$x],
'files' => $lessons['files'][$x],
'free' => $lessons['free'][$x],
]);
$lesson->save();
}
}
'$ X <數($教訓)' –
不是爲我工作 – tech
SO輸出'$ lessons','$ course'並查看出了什麼問題 –