There is an error in having contiguous paging function paginate during laravel data operation. What's going on?
某草草
某草草 2017-05-16 16:49:05
0
1
856

The database data is like this:

I want to use the having statement to get outcounts > 0;
uses paging, sohavingis followed by the paging functionpaginate

But this error is reported:

If Ihavingis followed by theget()function, then there is no problem,

You can find the data ofcounts > 0

What's going on?

Ishavingfollowed by the paging functionpaginatea bug?
How to solve it?

某草草
某草草

reply all (1)
巴扎黑

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)

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!