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