misc_pterodactyl-panel/app/Transformers/Api/Client/AllocationTransformer.php

35 lines
781 B
PHP
Raw Normal View History

<?php
namespace Pterodactyl\Transformers\Api\Client;
use Pterodactyl\Models\Allocation;
class AllocationTransformer extends BaseClientTransformer
{
/**
* Return the resource name for the JSONAPI output.
*
* @return string
*/
public function getResourceName(): string
{
return 'allocation';
}
/**
* Return basic information about the currently logged in user.
*
* @param \Pterodactyl\Models\Allocation $model
* @return array
*/
public function transform(Allocation $model)
{
return [
'ip' => $model->ip,
'ip_alias' => $model->ip_alias,
'port' => $model->port,
'is_default' => $model->server->allocation_id === $model->id,
];
}
}