【发布时间】:2018-04-01 10:14:16
【问题描述】:
我有一个关于创建表的问题。
我想这样做:
但我得到了这个:
我已经尝试了所有方法,但我意识到循环存在问题。我尝试将@endforeach 放在</tr> 之前。但是桌子看起来更乱了。
这是我的代码
<div class="col-md-12 text-center">
<div class="datagrid">
<table class="table table-hover">
<thead>
<tr>
<th>No</th>
<th>Booking ID</th>
<th>Name</th>
<th>Identity</th>
<th>Diver Status</th>
<th>Status</th>
<th>Payment</th>
</tr>
</thead>
<tbody>
@foreach($report->bookings as $booking)
<tr>
<td class="border" rowspan="{{count($booking->divers)}}">{{ $loop->index+1 }}</td>
<td rowspan="{{count($booking->divers)}}">{{$booking->booking_id}}</td>
@foreach($booking->divers as $diver)
<td>{{$diver->name}}</td>
<td>{{$diver->identity}}</td>
<td>{{$diver->license}}</td>
<td rowspan="{{count($diver->name)}}">{{$booking->status }}</td>
<td rowspan="{{count($diver->name)}}">{{ $booking->total_fee }}</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
</div>
</div>
我想如何将状态和付款与 no 和 booking id 合并?
【问题讨论】:
标签: html loops html-table row