the only way I found is like that
$img = File::allFiles(public_path(). '/img/risunki');
$currentPage = LengthAwarePaginator::resolveCurrentPage();
if (is_null($currentPage)) {$currentPage = 1;}
$collection = new Collection($img);
$perPage = 20;
$currentPageImgResults = $collection->slice( ($currentPage - 1) * $perPage, $perPage)->all();
$paginatedImgResults = new LengthAwarePaginator($currentPageImgResults, count($collection), $perPage, $currentPage);
$paginatedImgResults->setPath('risunki');
Doing this I have correct pagination behaviour when I'm on default page and when clicking on the pagination links. But then when I check manually url http://site.dev/links/risunki?page=0 then I see results from the last page. I don't know if it should be like that?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community