I want to paginate a array with LengthAwarePaginator in Laravel.
When I try navigate between pages, laravel shows this error:
NotFoundHttpException in RouteCollection.php line 161
This is my code:
//$queries1 is an array.
$currentPage = LengthAwarePaginator::resolveCurrentPage();
$collection = new Collection($queries1);
$currentPageSearchResults = $collection->slice($currentPage * 5, 5)->all();
$paginatedSearchResults= new LengthAwarePaginator($currentPageSearchResults, count($collection), 5);
//configure Path
$paginatedSearchResults->setPath(App::getLocale().'/activity/search_Activity');
return view(App::getLocale().'.activities.ActivityResults', ['results' => $paginatedSearchResults]);
If I don't set the path, the link of the pagination, automatically redirect to '/'
What could be happening?
Thanks for help