- Fix: Notifiable-Trait zum User-Model hinzugefuegt (behebt notify()-500er) - Installer: SMTP-Verbindungstest mit EsmtpTransport + Ueberspringen-Link - Admin: Neuer E-Mail-Tab mit SMTP-Konfiguration + Verbindungstest - Admin: Lazy Quill-Initialisierung (nur sichtbare Locale wird geladen) - Uebersetzungen: 17 neue Mail-Keys in allen 6 Sprachen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
1.2 KiB
PHP
Executable File
57 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\ParticipantStatus;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class EventParticipant extends Model
|
|
{
|
|
protected $fillable = [
|
|
'event_id',
|
|
'player_id',
|
|
'user_id',
|
|
'status',
|
|
'note',
|
|
'responded_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'status' => ParticipantStatus::class,
|
|
'responded_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function event(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Event::class);
|
|
}
|
|
|
|
public function player(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Player::class)->withTrashed();
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class)->withTrashed();
|
|
}
|
|
|
|
public function setByUser(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'set_by_user_id')->withTrashed();
|
|
}
|
|
|
|
public function participantName(): string
|
|
{
|
|
if ($this->user_id) {
|
|
return $this->user?->name ?? __('ui.unknown');
|
|
}
|
|
|
|
return $this->player?->full_name ?? __('ui.unknown');
|
|
}
|
|
}
|