public function index()
{
$table-A = A::all()->count();
$table-B = B::all()->count();
return view('home',compact('table-A','table-B'))
}
答案 0 :(得分:0)
以这种方式进行:
public function index()
{
$tableA = A::all()->count();
$tableB = B::all()->count();
$sum = $tableA + $tableB;
return view('home',compact('tableA','tableB', 'sum'))
}