I am beginner at laravel and i want to add multiple record into database table and I have a returned request below but I have no idea how to submit data into table how can I make logic in controller Does anyone have an idea how to to do that please help me thanks. Database table
projectissue table
Id | task | date| project_id
Controller
public function issuesUpdate(Request $request,Project $project)
{
return redirect()->route('project');
}
return $request
{
"_token": "S6typbw0hywPqaUdxCTqWeJNieyl3VieQhCHqDZ7",
project_id=42;
"date": [
"2020-07-06",
"2020-07-22",
"2020-07-11"
],
"issue": [
"dsfsdfsdfsdf",
"dsfsdfsdfsdf",
"dsfsdfsdfsdf"
]
}
Route
Route::post('/projects/{project}/issues/update', "ProjectController@issuesUpdate")-
>name('project.issues.update');
Html view
<form action="{{ route('project.issues.update',[$project->id])}}" method="POST">
@csrf
<div class="portlet">
<div class="portlet-heading bg-light-theme">
<h3 class="portlet-title">
<span class="ti-user mr-2">
</span>Add Issues
</h3>
<div class="portlet-widgets">
<span class="divider">
</span>
<button type="submit" class="btn btn-white waves-effect btn-rounded">
<span class="btn-label">
<i class="fa fa-save">
</i>
</span> Save
</button>
</div>
<div class="clearfix">
</div>
</div>
<div id="bg-inverse" class="panel-collapse collapse show" style="">
<div class="portlet-body">
<div class="card-box">
<div class="row">
<div class="col-md-12 mt20">
<div class="addMore">
<div class="addmore_cont">
<div class="addMore_btn">
<div class="mt12 pull-right">
<button type="button" title="Add More" class="btn btn-success waves-effect waves-light btn-sm add_more" data-key="">
<i class="fa fa-plus">
</i>
</button>
</div>
<div class="row addmore_issues">
<div class="col-md-12">
<div class="row">
<div class="col-md-5">
<div class="form-group">
<input required type="date" value="" name="date[]" class="form-control"
aria-describedby="emailHelp" >
</div>
</div>
<div class="col-md-5">
<div class="form-group">
<input required type="text" value="" name="issue[]" class="form-control"
aria-describedby="emailHelp" placeholder="task...">
</div>
</div>
<div class="col-md-1 mt12">
<button type="button" class="btn btn-danger waves-effect waves-light btn-sm delete">
<i
class="fa fa-times">
</i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>