Files

34 lines
836 B
PHP
Raw Permalink Normal View History

2019-12-28 12:03:19 -08:00
<?php
namespace Pterodactyl\Transformers\Api\Client;
use Pterodactyl\Models\User;
2022-12-14 17:05:46 -07:00
use Pterodactyl\Transformers\Api\Transformer;
2019-12-28 12:03:19 -08:00
2022-12-14 17:05:46 -07:00
class UserTransformer extends Transformer
2019-12-28 12:03:19 -08:00
{
/**
* 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.
*/
2022-10-14 10:59:20 -06:00
public function transform(User $model): array
2019-12-28 12:03:19 -08:00
{
return [
'uuid' => $model->uuid,
'username' => $model->username,
'email' => $model->email,
2022-12-15 12:26:34 -07:00
'image' => $model->avatar_url,
2019-12-28 12:03:19 -08:00
'2fa_enabled' => $model->use_totp,
2022-12-14 17:05:46 -07:00
'created_at' => self::formatTimestamp($model->created_at),
2019-12-28 12:03:19 -08:00
];
}
}