我需要将多个图像和文本存储在不同的行中(在数据库中)请帮助我提前致谢
**Create Blade**
<div class="card-header card-header-border-bottom " >
<h2 class="text-center mt-2">Create Content</h2>
</div>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<form action="{{ route('Content.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="form-group col-md-6">
<label for="exampleFormControlTextarea1">Image</label>
<input type="file" name="image[]" class="form-control" id="exampleFormControlInput1"
placeholder="Enter Contact phone">
</div>
<button id="removeRow" type="button" class="btn btn-danger">Remove Program</button>
<div id="newRow"></div>
<button id="addRow" type="button" class="btn btn-warning mb-5">Add Program</button>
</div>
<div class="row">
<div class="col-lg-12 mb-5">
<button type="submit" class="btn btn-primary btn-default">Submit</button>
</div>
</div>
</form>
<script type="text/javascript">
$("#addRow").click(function () {
var html = '';
html += '<div class="form-group col-md-6">';
html += '<label for="exampleFormControlTextarea1">Image</label>';
html += '<input type="file" name="image[]" class="form-control" id="exampleFormControlInput1">';
html += '</div>';
html += '<button id="removeRow" type="button" class="btn btn-danger">Remove Program</button>';
$('#newRow').append(html);
});
$(document).on('click', '#removeRow', function () {
$(this).closest('#inputFormRow').remove();
});
</script>
**Controller**
public function store(Request $request)
{
if($request->hasfile('image'))
{
foreach($request->file('image') as $image)
{
$name=$image->getClientOriginalName();
$image->move(public_path().'/image/content/', $name);
$datas[] = $name;
}
}
foreach ($request->date as $key=> $date){
$data = new Content();
$data->date = $date;
$data->title = $request->title[$key];
$data->subtitle = $request->subtitle[$key];
$data->content = $request->content[$key];
$data->image = $request->image[$key];
$data->save();
}
return view('backend.content.index');
}
**Migration Table**
public function up()
{
Schema::create('contents', function (Blueprint $table) {
$table->id();
$table->string('date');
$table->string('title');
$table->string('subtitle');
$table->text('content');
$table->string('image');
$table->timestamps();
});
}