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

32 lines
709 B
PHP
Raw Permalink Normal View History

<?php
namespace Pterodactyl\Transformers\Api\Client;
use Pterodactyl\Models\User;
2022-12-15 00:05:46 +00:00
use Pterodactyl\Transformers\Api\Transformer;
2022-12-15 00:05:46 +00:00
class AccountTransformer extends Transformer
{
/**
* Return the resource name for the JSONAPI output.
*/
public function getResourceName(): string
{
return 'user';
}
/**
* Return basic information about the currently logged-in user.
*/
public function transform(User $model): array
{
return [
'id' => $model->id,
'admin' => $model->root_admin,
'username' => $model->username,
'email' => $model->email,
'language' => $model->language,
];
}
}