2019-12-28 20:03:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Transformers\Api\Client;
|
|
|
|
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
use Pterodactyl\Models\User;
|
2021-08-07 20:06:45 +00:00
|
|
|
use Pterodactyl\Transformers\Api\Transformer;
|
2019-12-28 20:03:19 +00:00
|
|
|
|
2021-08-07 20:06:45 +00:00
|
|
|
class UserTransformer extends Transformer
|
2019-12-28 20:03:19 +00:00
|
|
|
{
|
|
|
|
public function getResourceName(): string
|
|
|
|
{
|
|
|
|
return User::RESOURCE_NAME;
|
|
|
|
}
|
|
|
|
|
2021-08-07 20:06:45 +00:00
|
|
|
public function transform(User $model): array
|
2019-12-28 20:03:19 +00:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
'uuid' => $model->uuid,
|
|
|
|
'username' => $model->username,
|
|
|
|
'email' => $model->email,
|
|
|
|
'image' => 'https://gravatar.com/avatar/' . md5(Str::lower($model->email)),
|
|
|
|
'2fa_enabled' => $model->use_totp,
|
2021-08-07 20:06:45 +00:00
|
|
|
'created_at' => self::formatTimestamp($model->created_at),
|
2019-12-28 20:03:19 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|