這個問題在這里已經有了答案: 選擇 MySQL 中的最后一行 (10 個回答) 4 天前關閉。
我試圖從我放入表格的資料中顯示一些資訊。但結果是這樣,盡管努力顯示添加到該表中的最新記錄的資訊,但只顯示第一條記錄的資訊。
我會很感激你的幫助...
這是我的刀片頁面中的代碼
@if(!empty(Auth::user()->credo->money[0]->orderBy('updated_at','ASC')->get('is_payed')) == 1 )
<h4>You are eligible. <br>BMFA thanks you for the corcern.<hr/><span style="font-size:12px">
You refund is {{ Auth::user()->credo->money[0]->amount }}$</span>
</h4>
@endif
我的控制器
public function index()
{
$Users = User::all();
$Credos = Credos::all();
$MoneyP = MoneyP::all();
$context = [
'Credos' => $Credos,
'MoneyP' => $MoneyP,
'Users' => $Users,
];
return view('/')->with($context);
}
uj5u.com熱心網友回復:
$results = Auth::user()->credo->money[0]->orderBy('updated_at','ASC')->get();
@foreach ($results as $result)
@if($result->is_payed == 1)
<h4>You are eligible. <br>BMFA thanks you for the corcern.<hr/><span style="font-size:12px">
You refund is {{ Auth::user()->credo->money[0]->amount }}$</span>
</h4>
@endif
@endforeach
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/399462.html
