mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fix for API pagination
This commit is contained in:
parent
0d58e6da94
commit
59969a4677
@ -139,8 +139,10 @@ class BaseAPIController extends Controller
|
|||||||
|
|
||||||
if (is_a($query, "Illuminate\Database\Eloquent\Builder")) {
|
if (is_a($query, "Illuminate\Database\Eloquent\Builder")) {
|
||||||
$limit = min(MAX_API_PAGE_SIZE, Input::get('per_page', DEFAULT_API_PAGE_SIZE));
|
$limit = min(MAX_API_PAGE_SIZE, Input::get('per_page', DEFAULT_API_PAGE_SIZE));
|
||||||
$resource = new Collection($query->get(), $transformer, $entityType);
|
$paginator = $query->paginate($limit);
|
||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($query->paginate($limit)));
|
$query = $paginator->getCollection();
|
||||||
|
$resource = new Collection($query, $transformer, $entityType);
|
||||||
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
} else {
|
} else {
|
||||||
$resource = new Collection($query, $transformer, $entityType);
|
$resource = new Collection($query, $transformer, $entityType);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user