Path: blob/1.0-develop/app/Http/Controllers/Api/Application/Nests/NestController.php
10277 views
<?php12namespace Pterodactyl\Http\Controllers\Api\Application\Nests;34use Pterodactyl\Models\Nest;5use Pterodactyl\Contracts\Repository\NestRepositoryInterface;6use Pterodactyl\Transformers\Api\Application\NestTransformer;7use Pterodactyl\Http\Requests\Api\Application\Nests\GetNestsRequest;8use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;910class NestController extends ApplicationApiController11{12/**13* NestController constructor.14*/15public function __construct(private NestRepositoryInterface $repository)16{17parent::__construct();18}1920/**21* Return all Nests that exist on the Panel.22*/23public function index(GetNestsRequest $request): array24{25$nests = $this->repository->paginated($request->query('per_page') ?? 50);2627return $this->fractal->collection($nests)28->transformWith($this->getTransformer(NestTransformer::class))29->toArray();30}3132/**33* Return information about a single Nest model.34*/35public function view(GetNestsRequest $request, Nest $nest): array36{37return $this->fractal->item($nest)38->transformWith($this->getTransformer(NestTransformer::class))39->toArray();40}41}424344