laravel - Laravel 中未定义的变量 $pending
问题描述
尝试使用 where 条件获取计数时出现未定义的变量错误。
事务控制器.php
public function index()
{
$pending = transactions::where('trans_status','Pending')->showProduct('0');
return view('layouts.content',
['pending' => $pending]);
}
content.blade.php
<h2 class="text-right"><i class="ti-alert f-left"></i><span>{{count($pending)}}</span></h2>
解决方案
推荐阅读
- c - 是否将一个函数指针转换为等效函数,该函数指针接受一个 const 指针参数,但具有非常量指针参数可以吗?
- r - 在 dplyr 中使用 Select Helpers
- python - 将一个函数内部定义的变量传递给另一个函数
- discord - 时间计数器脚本 discord.js
- c# - 在场景大纲中运行每个示例后如何存储 ID?
- vue.js - 如何在类星体表中制作行跨度
- cefsharp - CefSharp 拼写检查器无法在某些 PC 上运行
- rpa - 目标方法、记录器、向导和对象存储库有什么作用?
- php - 即使填写了表格,也会抛出错误?
- php - 如何使用 laravel 数据表将参数传递给控制器?