1 回答

TA贡献1810条经验 获得超4个赞
尝试一下,使用keyBy函数将day列作为结果的索引$scheduleDetails
@php $newScheduleDetails = $scheduleDetails->keyBy('day'); @endphp
@for ($i = 0; $i < 7; $i++)
@if($newScheduleDetails->has($i))
<td class="p-1">
<input name="from[]" value="{{$newScheduleDetails->get($i)->from_time }}" id="from{{$i}}" style="width:50px;margin:auto" type="text">
</td>
<td class="p-1">
<input name="until[]" value="{{$newScheduleDetails->get($i)->until_time }}" id="until{{$i}}" style="width:50px;margin:auto" type="text">
</td>
@else
<td>{{$i}}</td>
<td>{{$i}}</td>
@endif
@endfor
- 1 回答
- 0 关注
- 81 浏览
添加回答
举报