1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 17:12:30 +01:00
Pterodactyl-Panel/app/Transformers/Api/Client/UserTransformer.php
2022-12-15 12:26:34 -07:00

34 lines
836 B
PHP

<?php
namespace Pterodactyl\Transformers\Api\Client;
use Pterodactyl\Models\User;
use Pterodactyl\Transformers\Api\Transformer;
class UserTransformer extends Transformer
{
/**
* Return the resource name for the JSONAPI output.
*/
public function getResourceName(): string
{
return User::RESOURCE_NAME;
}
/**
* Transforms a User model into a representation that can be shown to regular
* users of the API.
*/
public function transform(User $model): array
{
return [
'uuid' => $model->uuid,
'username' => $model->username,
'email' => $model->email,
'image' => $model->avatar_url,
'2fa_enabled' => $model->use_totp,
'created_at' => self::formatTimestamp($model->created_at),
];
}
}