Always allow specifying a page size with the API; closes #3218

This commit is contained in:
Dane Everitt 2021-03-26 09:03:51 -07:00
parent 9b46d59045
commit 48ad8f538e
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
8 changed files with 10 additions and 9 deletions

View file

@ -83,7 +83,7 @@ class FindViableNodesService
*
* @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException
*/
public function handle(int $page = null)
public function handle(int $perPage = null, int $page = null)
{
Assert::integer($this->disk, 'Disk space must be an int, got %s');
Assert::integer($this->memory, 'Memory usage must be an int, got %s');
@ -103,7 +103,7 @@ class FindViableNodesService
->havingRaw('(IFNULL(SUM(servers.disk), 0) + ?) <= (nodes.disk * (1 + (nodes.disk_overallocate / 100)))', [$this->disk]);
if (!is_null($page)) {
$results = $results->paginate(50, ['*'], 'page', $page);
$results = $results->paginate($perPage ?? 50, ['*'], 'page', $page);
} else {
$results = $results->get()->toBase();
}