jikan-rest/app/Services/EloquentBuilderPaginatorService.php
pushrbx a145f18bbd wip - major refactor
- AppServiceProvider is needs more work to wire in new services
- todo: more dtos
- todo: add unit tests
- todo: add more integration tests
2023-05-21 11:14:34 +01:00

19 lines
581 B
PHP

<?php
namespace App\Services;
use App\Concerns\ResolvesPaginatorParams;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
final class EloquentBuilderPaginatorService implements QueryBuilderPaginatorService
{
use ResolvesPaginatorParams;
public function paginate(\Illuminate\Database\Eloquent\Builder|\Laravel\Scout\Builder $builder, ?int $limit = null, ?int $page = null): LengthAwarePaginator
{
["limit" => $limit, "page" => $page] = $this->getPaginatorParams($limit, $page);
return $builder->paginate($limit, ['*'], null, $page);
}
}