mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-05-14 20:17:35 +08:00
34 lines
676 B
PHP
34 lines
676 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
class Passkey extends NexusModel
|
|
{
|
|
protected $table = 'user_passkeys';
|
|
|
|
public $timestamps = true;
|
|
|
|
protected $fillable = [
|
|
'id', 'user_id', 'aaguid', 'credential_id', 'public_key', 'counter',
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
public function getAaguidFormatted(): string
|
|
{
|
|
$guid = $this->aaguid;
|
|
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)
|
|
);
|
|
}
|
|
|
|
}
|