Insert multiple rows value to database using dynamic form in Laravel

Don't use this:
<input type="text" name="rows[][link]" value="521"> 
<input type="text" name="rows[][store]" value="542">
This will generate $rows like following:
  0 => ["link" => "foo"], 
  1 => ["store" => "bar"] 
]
But your PHP code expects $rows to be like because you want to pass 4 value:
  0 => [ "link" => "foo", 
       "store" => "bar" 
     ], 
  1 => [ "link" => "foo", 
         "store" => "bar"
     ] 
]
One way to generate the expected values is to specify the row keys in your elements:
<input type="text" name="rows[0][link]" value="123"> 
<input type="text" name="rows[0][store]" value="456"> 
<input type="text" name="rows[1][link]" value="789"> 
<input type="text" name="rows[1][store]" value="963">



EmoticonEmoticon