数据仅在 Laravel 应用程序中插入最后一个数组
问题描述
我有这个月的天数列表.但问题是当我插入或添加数据时,它只输入了列表中的最后一个数组或数据.例如,我添加 Jan-02-2019,
然后它会插入 Jan-31-2019
.
控制器
这是视图和表单:
我认为这是因为您构建 HTML 表单的方式.如果我正确理解了您的问题,以下内容应该可以解决问题:
<table class="table"><头><tr><今天>今天</th><th>TIME IN</th><th>超时</th><th>Action</th></tr></thead>@foreach($dates 作为 $date){!!Form::open(['action' => 'AdminEmployeeFilemController@insertSchedule', 'method' => 'POST']) !!}<input type="hidden" name="hidEmployeeno" value="{{ $employee->employee_no }}"><input type="hidden" name="hidEmployeeLast" value="{{ $employee->last_name }}"><input type="hidden" name="hidEmployeeFirst" value="{{ $employee->first_name }}"><tr><td><b>{{ $date }}</b></td><input type="hidden" name="dateToday" value="{{ $date }}"><td><input type="time" name="timeIn" class="form-control col-md-10"></td><td><input type="time" name="timeOut" class="form-control col-md-10"></td><td>{{ Form::button('<i class="fa fa-clock"> SET TIME</i>',['type' => 'submit','class' => 'btn btn-warning btn-sm', 'style'=>"display: inline-block;"]) }}</td></tr>{!!表单::关闭() !!}@endforeach</tbody>
I have a list of days for this month. But the problem is when I insert or add the data it only entered the last array or data from the list. For example, I add Jan-02-2019,
and it will then insert Jan-31-2019
.
Controller
Here are the view and form:
I think it's because of the way you structured your HTML form. If I understood your question correctly, the following should make it work:
这篇关于数据仅在 Laravel 应用程序中插入最后一个数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!