我想在列出所有用户的页面上获取用户总数.这一页应该分页.
So far, this is what I've come up with:
Controller
$users = User::paginate(10);
return View::make('index', compact('users'));
View:
{{{ count($users) }}}
但这只给出了当前页面的用户数.我想计算完整的结果集,如果可能的话,不需要再次查询数据库.
我想在列出所有用户的页面上获取用户总数.这一页应该分页.
So far, this is what I've come up with:
Controller
$users = User::paginate(10);
return View::make('index', compact('users'));
View:
{{{ count($users) }}}
但这只给出了当前页面的用户数.我想计算完整的结果集,如果可能的话,不需要再次查询数据库.