I have a issue related to Laravel5 Manual Pagination. I need to process an array of query builder result and some other arrays and make a pagination for that.
controller.
public function searchCategory($id){
$arr = DB::table('business_businesscatagories')->lists('fk_business_id');
return Paginator::make($arr, count($arr), 2);
}
Namespaces..
use Illuminate\Pagination\LengthAwarePaginator as Paginator;
But I got the error like below..
FatalErrorException in IndexController.php line 122:
Call to undefined method Illuminate\Pagination\LengthAwarePaginator::make()
How can I solve this issue....
I examined Illuminate\\Pagination\\LengthAwarePaginator
and was able to confirm that it doesn't have make
method.
However you can achieve this by using its constructor method.
__construct(mixed $items, int $perPage, int|null $currentPage = null, array $options = array())
Since you already have the correct namespace specified:
use Illuminate\Pagination\LengthAwarePaginator as Paginator;
You could simply do this:
$paginator = new Paginator($items, $total, $per_page);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.