41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Pterodactyl\Http\Controllers\Api\Application\Nests;
|
|
|
|
use Pterodactyl\Models\Nest;
|
|
use Pterodactyl\Transformers\Api\Application\NestTransformer;
|
|
use Pterodactyl\Http\Requests\Api\Application\Nests\GetNestsRequest;
|
|
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
|
|
|
|
class NestController extends ApplicationApiController
|
|
{
|
|
/**
|
|
* NestController constructor.
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Return all Nests that exist on the Panel.
|
|
*/
|
|
public function index(GetNestsRequest $request): array
|
|
{
|
|
$nests = Nest::query()->paginate($request->query('per_page') ?? 50);
|
|
|
|
return $this->fractal->collection($nests)
|
|
->transformWith($this->getTransformer(NestTransformer::class))
|
|
->toArray();
|
|
}
|
|
|
|
/**
|
|
* Return information about a single Nest model.
|
|
*/
|
|
public function view(GetNestsRequest $request, Nest $nest): array
|
|
{
|
|
return $this->fractal->item($nest)
|
|
->transformWith($this->getTransformer(NestTransformer::class))
|
|
->toArray();
|
|
}
|
|
}
|