Support pagination of server backups, closes #2787

This commit is contained in:
Dane Everitt 2020-12-06 12:01:42 -08:00
parent 8a97b73a6c
commit a8d9eccf9c
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 53 additions and 22 deletions

View file

@ -60,7 +60,8 @@ class BackupController extends ClientApiController
*/
public function index(GetBackupsRequest $request, Server $server)
{
return $this->fractal->collection($server->backups()->paginate(20))
$limit = min($request->query('per_page') ?? 20, 50);
return $this->fractal->collection($server->backups()->paginate($limit))
->transformWith($this->getTransformer(BackupTransformer::class))
->toArray();
}