2019-03-24 00:47:20 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Transformers\Api\Client;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\Allocation;
|
|
|
|
|
|
|
|
class AllocationTransformer extends BaseClientTransformer
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Return the resource name for the JSONAPI output.
|
|
|
|
*/
|
|
|
|
public function getResourceName(): string
|
|
|
|
{
|
|
|
|
return 'allocation';
|
|
|
|
}
|
|
|
|
|
2022-10-14 16:59:20 +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
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|