Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Transformers/Api/Client/SubuserTransformer.php
10284 views
1
<?php
2
3
namespace Pterodactyl\Transformers\Api\Client;
4
5
use Pterodactyl\Models\Subuser;
6
7
class SubuserTransformer extends BaseClientTransformer
8
{
9
/**
10
* Return the resource name for the JSONAPI output.
11
*/
12
public function getResourceName(): string
13
{
14
return Subuser::RESOURCE_NAME;
15
}
16
17
/**
18
* Transforms a subuser into a model that can be shown to a front-end user.
19
*
20
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
21
*/
22
public function transform(Subuser $model): array
23
{
24
return array_merge(
25
$this->makeTransformer(UserTransformer::class)->transform($model->user),
26
['permissions' => $model->permissions]
27
);
28
}
29
}
30
31