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 關注
- 98 瀏覽
添加回答
舉報