1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 17:12:30 +01:00
Pterodactyl-Panel/app/Transformers/Api/Client/SubuserTransformer.php
2022-12-14 17:05:46 -07:00

29 lines
666 B
PHP

<?php
namespace Pterodactyl\Transformers\Api\Client;
use Pterodactyl\Models\Subuser;
use Pterodactyl\Transformers\Api\Transformer;
class SubuserTransformer extends Transformer
{
/**
* Return the resource name for the JSONAPI output.
*/
public function getResourceName(): string
{
return Subuser::RESOURCE_NAME;
}
/**
* Transforms a subuser into a model that can be shown to a front-end user.
*/
public function transform(Subuser $model): array
{
return array_merge(
(new UserTransformer())->transform($model->user),
['permissions' => $model->permissions]
);
}
}