feat: harden identity and recovery operations

This commit is contained in:
2026-08-04 20:24:18 +01:00
parent 7a4ac48aaf
commit eae2a44f46
30 changed files with 1428 additions and 21 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use App\Domain\Identity\Enums\RoleName;
use App\Domain\Identity\Models\ExternalIdentity;
use App\Domain\Identity\Models\Role;
use App\Domain\Reservations\Models\Reservation;
use Database\Factories\UserFactory;
@@ -58,6 +59,12 @@ class User extends Authenticatable implements PasskeyUser
return $this->hasMany(Reservation::class, 'requester_id');
}
/** @return HasMany<ExternalIdentity, $this> */
public function externalIdentities(): HasMany
{
return $this->hasMany(ExternalIdentity::class);
}
public function hasRole(RoleName|string $role): bool
{
$name = $role instanceof RoleName ? $role->value : $role;