2021-07-28 04:23:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Transformers\Api\Client;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\PersonalAccessToken;
|
2021-08-07 20:06:45 +00:00
|
|
|
use Pterodactyl\Transformers\Api\Transformer;
|
2021-07-28 04:23:11 +00:00
|
|
|
|
2021-08-07 20:06:45 +00:00
|
|
|
class PersonalAccessTokenTransformer extends Transformer
|
2021-07-28 04:23:11 +00:00
|
|
|
{
|
|
|
|
public function getResourceName(): string
|
|
|
|
{
|
|
|
|
return PersonalAccessToken::RESOURCE_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function transform(PersonalAccessToken $model): array
|
|
|
|
{
|
|
|
|
return [
|
2021-07-29 03:53:54 +00:00
|
|
|
'token_id' => $model->token_id,
|
|
|
|
'description' => $model->description,
|
2021-07-28 04:23:11 +00:00
|
|
|
'abilities' => $model->abilities ?? [],
|
2021-08-07 20:06:45 +00:00
|
|
|
'last_used_at' => self::formatTimestamp($model->last_used_at),
|
|
|
|
'created_at' => self::formatTimestamp($model->created_at),
|
|
|
|
'updated_at' => self::formatTimestamp($model->updated_at),
|
2021-07-28 04:23:11 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|