Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Transformers/Api/Client/AllocationTransformer.php
10284 views
1
<?php
2
3
namespace Pterodactyl\Transformers\Api\Client;
4
5
use Pterodactyl\Models\Allocation;
6
7
class AllocationTransformer extends BaseClientTransformer
8
{
9
/**
10
* Return the resource name for the JSONAPI output.
11
*/
12
public function getResourceName(): string
13
{
14
return 'allocation';
15
}
16
17
public function transform(Allocation $model): array
18
{
19
return [
20
'id' => $model->id,
21
'ip' => $model->ip,
22
'ip_alias' => $model->ip_alias,
23
'port' => $model->port,
24
'notes' => $model->notes,
25
'is_default' => $model->server->allocation_id === $model->id,
26
];
27
}
28
}
29
30