Commit ef8c47f5 authored by Yuri Resende's avatar Yuri Resende
Browse files

Corrigindo paginação nas avaliações

parent 7bbc03e4
Showing with 17 additions and 0 deletions
+17 -0
......@@ -4,6 +4,8 @@ namespace App\Providers;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
......@@ -26,5 +28,20 @@ class AppServiceProvider extends ServiceProvider
{
Paginator::useBootstrap();
Collection::macro('paginate', function($perPage, $total = null, $page = null, $pageName = 'page'): LengthAwarePaginator {
$page = $page ?: LengthAwarePaginator::resolveCurrentPage($pageName);
return new LengthAwarePaginator(
$this->forPage($page, $perPage)->values(),
$total ?: $this->count(),
$perPage,
$page,
[
'path' => LengthAwarePaginator::resolveCurrentPath(),
'pageName' => $pageName,
]
);
});
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment