mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 22:33:44 +02:00
webauthn: add controllers and transformers
This commit is contained in:
29
app/Transformers/Api/Client/WebauthnKeyTransformer.php
Normal file
29
app/Transformers/Api/Client/WebauthnKeyTransformer.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Pterodactyl\Transformers\Api\Client;
|
||||
|
||||
use LaravelWebauthn\Models\WebauthnKey;
|
||||
|
||||
class WebauthnKeyTransformer extends BaseClientTransformer
|
||||
{
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
return 'webauthn_key';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return basic information about the currently logged in user.
|
||||
*/
|
||||
public function transform(WebauthnKey $model): array
|
||||
{
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'name' => $model->name,
|
||||
'created_at' => $model->created_at->toIso8601String(),
|
||||
'last_used_at' => now()->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user