Closed mostafaznv closed 7 years ago
100% what @mostafaznv said... I had to do the same so that I could use multi-page and total count
Well, it is not so hard to implement by yourself.
I don't know if there was some changes, but in Laravel 5.2.45 there is no way to Pagintor work correctly because of mismatch in parameters:
public function __construct($items, $perPage, $currentPage = null, array $options = [])
Find in namespace Nqxcode\LuceneSearch\Query class Builder, you have there paginate function. Original code should be:
$page = $page ?: request()->input('page', 1);
$this->limit($perPage, ($page - 1) * $perPage);
$models = $this->get()->all();
$total = $this->count();
$paginator = new Paginator($models, $total, $perPage);
return $paginator;
You just need to change $paginator = new Paginator($models, $total, $perPage); to $paginator = new \Illuminate\Pagination\LengthAwarePaginator($models, $total, $perPage, $page); and that's it.
Pagination fixed.
hi ... thanks for your nice package... it works fine ... but i think it's better to use
LengthAwarePaginator
insteadPaginator
LengthAwarePaginator
shows a full pagination and i think if we have many pages, it's better to show a full pagination...i changed it in your package, but if you publish new version, all of my modifications gone ... please change that, i think it's more practical...