Laravel 如何使用foreach存储?

Laravel 如何使用foreach存储?,laravel,Laravel,我使用了所有五种方法,但没有一种有效。而不是存储在数据库中 我在教育部的桌子上有一排 我的表格就像这个演示 我的刀片 <input name="study[field]"> <input name="study[branch]"> <input name="study[grade_id]"> <input name="study[institution_id]">

我使用了所有五种方法,但没有一种有效。而不是存储在数据库中

我在教育部的桌子上有一排

我的表格就像这个演示

我的刀片

<input  name="study[field]">
<input  name="study[branch]">
<input  name="study[grade_id]">
<input  name="study[institution_id]">
<input  name="study[institution_education]">
<input  name="study[gpa]">
<input  name="study[nation_id]">
<input  name="study[province_id]">
<input  name="study[town_id]">
<input  name="study[branch]">
<input  name="study[province_name]">
<input  name="study[town_name]">
<input  name="study[entrance]">
<input  name="study[graduate]">
<input  name="study[currently_studying]">
我得到这个错误

获得dd后:

当您迭代$request->field时,您使用study[]作为字段数组名,您需要迭代$request->study


这是因为您没有创建输入字段数组。而是给研究[领域]起个名字

更改输入名称,如下所示

<input  name="field[]">
<input  name="branc[]">
<input  name="grade_id[]">
So on......

应该是$request->studyI更改了代码。但它没有保存在数据库中您是否仍然收到为每个人提供的错误无效参数?否,这将被更新,当我单击“添加其他学术记录”时,它会添加新行,当我填写新数据时,在最后一步,当我单击“提交”时,数据库中不会发生任何事情。我更改了您的代码。但它并没有保存在数据库中
 foreach ($request->study as $key => $value) {
       //your creation code here
    }
<input  name="field[]">
<input  name="branc[]">
<input  name="grade_id[]">
So on......
foreach ($request->field as $key => $value) {