【发布时间】:2022-01-26 09:09:18
【问题描述】:
我正在尝试从我放入表格的数据中显示一些信息。但结果是这样,尽管努力显示添加到该表中的最新记录的信息,但只显示第一条记录的信息。
感谢您的帮助...
这是我刀片页面中的代码
@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);
}
【问题讨论】:
-
如果您需要最近的行(日期时间最长),那么您必须使用
DESC排序。
标签: php laravel if-statement