1 回答

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊
嘗試一下,使用keyBy函數(shù)將day列作為結(jié)果的索引$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 關(guān)注
- 107 瀏覽
添加回答
舉報(bào)