misc_pterodactyl-panel/app/Transformers/Api/Client/SubuserTransformer.php
Matthew Penner cbcf62086f
Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-10-14 10:59:20 -06:00

29 lines
744 B
PHP

<?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.
*
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
*/
public function transform(Subuser $model): array
{
return array_merge(
$this->makeTransformer(UserTransformer::class)->transform($model->user),
['permissions' => $model->permissions]
);
}
}