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