skip如何在使用后和take查询中获得记录总数?
代码工作:
$records = Model::where('active', 1)
->skip(($page -1 ) * $max)
->take($max);
// List of records
$data = $records->get()
//Total of all records including the skip records
$total = $records->paginate()->total();
我想要这种方式,但代码不起作用:
$records = Model::where('active', 1)
->skip(($page -1 ) * $max)
->take($max)->get();
//Not Working
$total = $records->paginate()->total();
//Not Working
$total = $records->total();
//Not Working wrong result
$total = $records->count();
如何获取集合中的所有总记录?
慕桂英546537
当年话下
梵蒂冈之花