mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
- AppServiceProvider is needs more work to wire in new services - todo: more dtos - todo: add unit tests - todo: add more integration tests
19 lines
581 B
PHP
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);
|
|
}
|
|
}
|