mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Enabled setting per_page for API results
This commit is contained in:
parent
f74b30cdde
commit
65d70c620e
@ -134,8 +134,9 @@ class BaseAPIController extends Controller
|
||||
}
|
||||
|
||||
if (is_a($query, "Illuminate\Database\Eloquent\Builder")) {
|
||||
$limit = min(MAX_API_PAGE_SIZE, Input::get('per_page', DEFAULT_API_PAGE_SIZE));
|
||||
$resource = new Collection($query->get(), $transformer, $entityType);
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($query->paginate()));
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($query->paginate($limit)));
|
||||
} else {
|
||||
$resource = new Collection($query, $transformer, $entityType);
|
||||
}
|
||||
|
@ -599,6 +599,8 @@ if (!defined('CONTACT_EMAIL')) {
|
||||
define('TEST_USERNAME', 'user@example.com');
|
||||
define('TEST_PASSWORD', 'password');
|
||||
define('API_SECRET', 'API_SECRET');
|
||||
define('DEFAULT_API_PAGE_SIZE', 15);
|
||||
define('MAX_API_PAGE_SIZE', 100);
|
||||
|
||||
define('IOS_PRODUCTION_PUSH', env('IOS_PRODUCTION_PUSH', 'ninjaIOS'));
|
||||
define('IOS_DEV_PUSH', env('IOS_DEV_PUSH', 'devNinjaIOS'));
|
||||
|
Loading…
Reference in New Issue
Block a user