The database data is like this:
I want to use the having statement to get out counts > 0
;
uses paging, so having
is followed by the paging function paginate
But this error is reported:
If I having
is followed by the get()
function, then there is no problem,
You can find the data of counts > 0
What's going on?
Is having
followed by the paging function paginate
a bug?
How to solve it?
巴扎黑2017-05-16 16:51:05
paginate source code
public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null)
{
$page = $page ?: Paginator::resolveCurrentPage($pageName);
$total = $this->getCountForPagination($columns);
$results = $total ? $this->forPage($page, $perPage)->get($columns) : collect();
return new LengthAwarePaginator($results, $total, $perPage, $page, [
'path' => Paginator::resolveCurrentPath(),
'pageName' => $pageName,
]);
}
paginate takes the fields in the table by default, and there are no fields in the tablecounts
的
可换成skip($offset)->take($limit)