Uuid::class, 'counter' => 'integer', 'credential_id' => WebAuthnBase64::class, 'credential_public_key' => WebAuthnBase64::class, 'transports' => 'array', 'trust_path' => TrustPath::class, 'last_used_at' => 'immutable_datetime', ]; public function getPublicKeyCredentialSourceAttribute(): PublicKeyCredentialSource { return new PublicKeyCredentialSource( $this->credential_id, $this->type, $this->transports, $this->attestation_type, $this->trust_path, $this->aaguid ?? \Ramsey\Uuid\Uuid::uuid4(), $this->credential_public_key, (string) $this->user_id, $this->counter, ); } public function setPublicKeyCredentialSourceAttribute(PublicKeyCredentialSource $source): void { $this->credential_id = $source->getPublicKeyCredentialId(); $this->type = $source->getType(); $this->transports = $source->getTransports(); $this->attestation_type = $source->getAttestationType(); $this->trust_path = $source->getTrustPath(); $this->aaguid = $source->getAaguid(); $this->credential_public_key = $source->getCredentialPublicKey(); $this->counter = $source->getCounter(); $this->user_id = $source->getUserHandle(); } public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, "user_id", "id"); } }