mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-20 23:33:45 +02:00
Add tables for almost every admin change, update composer dependencies
This commit is contained in:
@@ -10,6 +10,7 @@ use Pterodactyl\Services\Locations\LocationCreationService;
|
||||
use Pterodactyl\Services\Locations\LocationDeletionService;
|
||||
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
||||
use Pterodactyl\Transformers\Api\Application\LocationTransformer;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationsRequest;
|
||||
@@ -71,10 +72,17 @@ class LocationController extends ApplicationApiController
|
||||
*/
|
||||
public function index(GetLocationsRequest $request): array
|
||||
{
|
||||
$perPage = $request->query('per_page', 10);
|
||||
if ($perPage < 1) {
|
||||
$perPage = 10;
|
||||
} else if ($perPage > 100) {
|
||||
throw new BadRequestHttpException('"per_page" query parameter must be below 100.');
|
||||
}
|
||||
|
||||
$locations = QueryBuilder::for(Location::query())
|
||||
->allowedFilters(['short', 'long'])
|
||||
->allowedSorts(['id'])
|
||||
->paginate(100);
|
||||
->paginate($perPage);
|
||||
|
||||
return $this->fractal->collection($locations)
|
||||
->transformWith($this->getTransformer(LocationTransformer::class))
|
||||
|
||||
Reference in New Issue
Block a user