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

32 lines
770 B
PHP
Raw Normal View History

2019-11-03 20:20:11 +00:00
<?php
namespace Pterodactyl\Transformers\Api\Client;
use Pterodactyl\Models\Subuser;
class SubuserTransformer extends BaseClientTransformer
{
/**
* 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.
2019-11-03 20:20:11 +00:00
*
* @return array|void
2021-01-23 20:33:34 +00:00
*
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
2019-11-03 20:20:11 +00:00
*/
public function transform(Subuser $model)
2019-11-03 20:20:11 +00:00
{
return array_merge(
$this->makeTransformer(UserTransformer::class)->transform($model->user),
['permissions' => $model->permissions]
);
2019-11-03 20:20:11 +00:00
}
}