Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Http/Controllers/Api/Application/Nests/EggController.php
10277 views
1
<?php
2
3
namespace Pterodactyl\Http\Controllers\Api\Application\Nests;
4
5
use Pterodactyl\Models\Egg;
6
use Pterodactyl\Models\Nest;
7
use Pterodactyl\Transformers\Api\Application\EggTransformer;
8
use Pterodactyl\Http\Requests\Api\Application\Nests\Eggs\GetEggRequest;
9
use Pterodactyl\Http\Requests\Api\Application\Nests\Eggs\GetEggsRequest;
10
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
11
12
class EggController extends ApplicationApiController
13
{
14
/**
15
* Return all eggs that exist for a given nest.
16
*/
17
public function index(GetEggsRequest $request, Nest $nest): array
18
{
19
return $this->fractal->collection($nest->eggs)
20
->transformWith($this->getTransformer(EggTransformer::class))
21
->toArray();
22
}
23
24
/**
25
* Return a single egg that exists on the specified nest.
26
*/
27
public function view(GetEggRequest $request, Nest $nest, Egg $egg): array
28
{
29
return $this->fractal->item($egg)
30
->transformWith($this->getTransformer(EggTransformer::class))
31
->toArray();
32
}
33
}
34
35