misc_pterodactyl-panel/app/Transformers/Api/Application/PackTransformer.php

41 lines
1.1 KiB
PHP
Raw Normal View History

<?php
2018-03-02 00:43:39 +00:00
namespace Pterodactyl\Transformers\Api\Application;
use Pterodactyl\Models\Pack;
2018-03-02 00:43:39 +00:00
class PackTransformer extends BaseTransformer
{
/**
2018-03-02 00:43:39 +00:00
* Return the resource name for the JSONAPI output.
*
2018-03-02 00:43:39 +00:00
* @return string
*/
2018-03-02 00:43:39 +00:00
public function getResourceName(): string
{
2018-03-02 00:43:39 +00:00
return Pack::RESOURCE_NAME;
}
/**
2018-03-02 00:43:39 +00:00
* Return a transformed User model that can be consumed by external services.
*
2018-03-02 00:43:39 +00:00
* @param \Pterodactyl\Models\Pack $pack
* @return array
*/
2018-03-02 00:43:39 +00:00
public function transform(Pack $pack): array
{
2018-03-02 00:43:39 +00:00
return [
'id' => $pack->id,
'uuid' => $pack->uuid,
'egg' => $pack->egg_id,
'name' => $pack->name,
'description' => $pack->description,
'is_selectable' => (bool) $pack->selectable,
'is_visible' => (bool) $pack->visible,
'is_locked' => (bool) $pack->locked,
'created_at' => $this->formatTimestamp($pack->created_at),
'updated_at' => $this->formatTimestamp($pack->updated_at),
];
}
}