2019-03-24 00:47:20 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Transformers\Api\Client;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\Allocation;
|
2021-08-07 20:06:45 +00:00
|
|
|
use Pterodactyl\Transformers\Api\Transformer;
|
2019-03-24 00:47:20 +00:00
|
|
|
|
2021-08-07 20:06:45 +00:00
|
|
|
class AllocationTransformer extends Transformer
|
2019-03-24 00:47:20 +00:00
|
|
|
{
|
|
|
|
public function getResourceName(): string
|
|
|
|
{
|
2021-08-07 20:06:45 +00:00
|
|
|
return Allocation::RESOURCE_NAME;
|
2019-03-24 00:47:20 +00:00
|
|
|
}
|
|
|
|
|
2021-08-07 20:06:45 +00:00
|
|
|
public function transform(Allocation $model): array
|
2019-03-24 00:47:20 +00:00
|
|
|
{
|
|
|
|
return [
|
2020-07-10 03:36:08 +00:00
|
|
|
'id' => $model->id,
|
2019-03-24 00:47:20 +00:00
|
|
|
'ip' => $model->ip,
|
2020-07-10 02:17:24 +00:00
|
|
|
'ip_alias' => $model->ip_alias,
|
2019-03-24 00:47:20 +00:00
|
|
|
'port' => $model->port,
|
2020-07-10 03:36:08 +00:00
|
|
|
'notes' => $model->notes,
|
2020-07-10 02:17:24 +00:00
|
|
|
'is_default' => $model->server->allocation_id === $model->id,
|
2019-03-24 00:47:20 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|