Error message :
Undefined property: Illuminate\Pagination\LengthAwarePaginator::$pageName
I am creating pagination from an array and following is the array.
$array = [▼
"A" => 1
"B" => 2
"C" => 3
"D" => 4
"E" => 5
]
And have the following code :
public function paginate($items, $perPage = 5, $page = null, $options = [])
{
$page = $page ?: (Paginator::resolveCurrentPage() ?: 1);
$items = $items instanceof Collection ? $items : Collection::make($items);
return new LengthAwarePaginator($items->forPage($page, $perPage), $items->count(), $perPage, $page, $options);
}
and calling the above method like the following :
$data = $this->paginate($array);
return view('test', ['data' => $data]);
And in test
view, I've the following to show pagination links:
<div> </div>
I've no idea what am I missing, I've checked quite a lot.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire