【发布时间】:2017-01-09 22:20:30
【问题描述】:
这可能是一个非常简单的问题。但我被卡住了。这是我的控制器函数,我试图将视图中的列总和传递到表的末尾
public function totalBillc3()
{
$total = Collection::where('collector_id', '=', 3)->sum('package');
return View::make('users.collector3', compact('total',$total));
}
在我写的观点中
<tr>
<td colspan="4" class="noborders"></td>
<th class="text-right" scope="row">TOTAL</th>
<td class="text-right">{{ $total}}</td>
</tr>
我的路线设置完美,但显示错误
Undefined variable: total (View: /Volumes/G/zipbillingsoft.com/resources/views/users/collector3.blade.php). Please help.
【问题讨论】:
标签: laravel controller blade