Added OTS create,store,show
CI/CD / test_and_check_app (push) Failing after 45s
CI/CD / Publish immutable image (push) Skipped

This commit is contained in:
2026-10-08 13:51:40 +02:00
parent 494d1a49e5
commit d0c606494e
14 changed files with 285 additions and 441 deletions
+16 -8
View File
@@ -10,6 +10,7 @@ use Illuminate\Database\Eloquent\Attributes\Hidden;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Notifications\DatabaseNotificationCollection;
@@ -35,6 +36,8 @@ use Laravel\Passkeys\Passkey;
* @property-read int|null $notifications_count
* @property-read Collection<int, Passkey> $passkeys
* @property-read int|null $passkeys_count
* @property-read Collection<int, OneTimeSecret> $receivedOneTimeSecrets
* @property-read int|null $received_one_time_secrets_count
* @property-read TeamMember|null $pivot
* @property-read Collection<int, Team> $teams
* @property-read int|null $teams_count
@@ -64,6 +67,19 @@ class User extends Authenticatable implements MustVerifyEmail, PasskeyUser
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable, PasskeyAuthenticatable, TwoFactorAuthenticatable;
public function teams(): BelongsToMany
{
return $this->belongsToMany(Team::class, 'team_members')
->using(TeamMember::class)
->withPivot(['role'])
->withTimestamps();
}
public function receivedOneTimeSecrets(): MorphMany
{
return $this->morphMany(OneTimeSecret::class, 'recipient');
}
/**
* Get the attributes that should be cast.
*
@@ -77,12 +93,4 @@ class User extends Authenticatable implements MustVerifyEmail, PasskeyUser
'two_factor_confirmed_at' => 'datetime',
];
}
public function teams(): BelongsToMany
{
return $this->belongsToMany(Team::class, 'team_members')
->using(TeamMember::class)
->withPivot(['role'])
->withTimestamps();
}
}