different names in different dynamics
linter / quality (push) Failing after 1m9s
tests / ci (8.3) (push) Failing after 51s
tests / ci (8.4) (push) Failing after 1m7s
tests / ci (8.5) (push) Failing after 1m9s

This commit is contained in:
Daan Meijer
2026-06-17 09:38:54 +02:00
parent 3c414e1ef1
commit 0fee3c1972
15 changed files with 283 additions and 11 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ class Dynamic extends Model
public function participants(): BelongsToMany
{
return $this->belongsToMany(User::class, 'participants')->withPivot('role');
return $this->belongsToMany(User::class, 'participants')->withPivot('role', 'display_name');
}
public function ledgers(): HasMany
+1
View File
@@ -12,5 +12,6 @@ class Participant extends Pivot
'user_id',
'dynamic_id',
'role',
'display_name',
];
}
+7
View File
@@ -49,6 +49,13 @@ class User extends Authenticatable implements PasskeyUser
return $this->hasMany(ReadCursor::class);
}
public function displayNameFor(Dynamic $dynamic): string
{
$participant = $dynamic->participants()->where('user_id', $this->id)->first();
return $participant?->pivot?->display_name ?? $this->name;
}
/**
* Get the attributes that should be cast.
*