3 回答

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超13個(gè)贊
您不需要對(duì)單個(gè)記錄應(yīng)用循環(huán),因?yàn)槟梢钥吹剿菃蝹€(gè)記錄。
<div class="card" >
<div class="card-body ">
<div class="shipment-number">
<span class="title" style="display: block; font-size: 25px!important;">{{$shipment->tracking_code }}</span>
</div><!-- Track_Num -->
</div>
<br><br>
<div id="shipper-info" class="row" >
<div class="col-md-6 detail-section">
<p class="shipper details"><strong>Shipper's Information</strong></p>
<div class="shipper details">
<p><span class="label">Shipper Name : </span>{{$shipment->sender_name }}</p>
<p><span class="label">Phone Number : </span>{{$shipment->telephone }}</p>
<p><span class="label">Email : </span>{{$shipment->sender_email }}</p>
<p><span class="label">Address : </span>{{$shipment->sender_address }}</p>
</div>
</div>
<div class="col-md-6 detail-section">
<p class="shipper details"><strong>Receiver's Information</strong></p>
<div class="receiver details">
<p><span class="label">Receiver Name : </span>{{$shipment->receiver_name }}</p>
<p><span class="label">Phone Number : </span>{{$shipment->receiver_telephone }}</p>
<p><span class="label">Address : </span>{{$shipment->receiver_address }}</p>
<p><span class="label">Email : </span>{{$shipment->receiver_email }}</p>
</div>
</div>
<div class="clear-line"></div>
</div>

TA貢獻(xiàn)1780條經(jīng)驗(yàn) 獲得超5個(gè)贊
您的調(diào)用->first()
將返回一批貨件而不是一批貨件,您可以使用->get()
或->paginate()
獲取模型的集合,然后在您的視圖中迭代它們。

TA貢獻(xiàn)1806條經(jīng)驗(yàn) 獲得超5個(gè)贊
獲取數(shù)據(jù)時(shí)刪除->first()
,->get() or ->paginate(x)
改為使用,這樣您就可以獲得集合。
在刀片文件中,foreach循環(huán)使用相同的變量作為集合和單個(gè)數(shù)據(jù)
@foreach($shipment as $shipment)
我建議您使用$shipments
集合作為變量,并使用 $shipment 作為實(shí)例。
x 只是一個(gè)數(shù)字
- 3 回答
- 0 關(guān)注
- 201 瀏覽
添加回答
舉報(bào)