Added OTS create,store,show
This commit is contained in:
+16
-8
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user