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';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return basic information about the currently logged in user.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function transform(Allocation $model)
|
|
|
|
{
|
|
|
|
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
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|