2019-11-03 21:20:11 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Transformers\Api\Client;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\Subuser;
|
2022-12-15 01:05:46 +01:00
|
|
|
use Pterodactyl\Transformers\Api\Transformer;
|
2019-11-03 21:20:11 +01:00
|
|
|
|
2022-12-15 01:05:46 +01:00
|
|
|
class SubuserTransformer extends Transformer
|
2019-11-03 21:20:11 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Return the resource name for the JSONAPI output.
|
|
|
|
*/
|
|
|
|
public function getResourceName(): string
|
|
|
|
{
|
|
|
|
return Subuser::RESOURCE_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-12-28 21:03:19 +01:00
|
|
|
* Transforms a subuser into a model that can be shown to a front-end user.
|
2019-11-03 21:20:11 +01:00
|
|
|
*/
|
2022-10-14 18:59:20 +02:00
|
|
|
public function transform(Subuser $model): array
|
2019-11-03 21:20:11 +01:00
|
|
|
{
|
2020-03-27 22:23:13 +01:00
|
|
|
return array_merge(
|
2022-12-15 01:05:46 +01:00
|
|
|
(new UserTransformer())->transform($model->user),
|
2020-03-27 22:23:13 +01:00
|
|
|
['permissions' => $model->permissions]
|
|
|
|
);
|
2019-11-03 21:20:11 +01:00
|
|
|
}
|
|
|
|
}
|