Support the ongoing development of Laravel.io →
posted 9 years ago
Requests
Last updated 2 years ago.
0

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?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

schel4ok schel4ok Joined 15 Feb 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.