Files
nexusphp/app/Models/Passkey.php
T

34 lines
676 B
PHP
Raw Normal View History

2025-03-09 14:34:25 +08:00
<?php
namespace App\Models;
class Passkey extends NexusModel
{
protected $table = 'user_passkeys';
public $timestamps = true;
protected $fillable = [
2026-04-23 01:04:30 +07:00
'id', 'user_id', 'aaguid', 'credential_id', 'public_key', 'counter',
2025-03-09 14:34:25 +08:00
];
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
2026-04-23 01:04:30 +07:00
public function getAaguidFormatted(): string
{
$guid = $this->aaguid;
2025-03-09 14:34:25 +08:00
return sprintf(
'%s-%s-%s-%s-%s',
substr($guid, 0, 8),
substr($guid, 8, 4),
substr($guid, 12, 4),
substr($guid, 16, 4),
substr($guid, 20, 12)
);
}
}