I have problem with my code when i\'m trying to save multiple data into database at the same time, this is my code to save into database:
foreach ($data as $
I think batch insert is the best solution for this problem.
but there is one problem with your pic of code that is this code will create only one data row(first row) in data table and update to that same model
solution for your code is
foreach ($data as $value) {
$model = new Model(); // creating new instance of model
$model->route = $value[0][1];
$model->begin_point = $value[0][2];
$model->begin_point = $value[0][3];
$model->save();
}
return $this->redirect('index');