Live Show data model + workflow
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-05 12:31:54 +01:00
parent c07687102e
commit 4718998e07
6 changed files with 317 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ class Event extends Model
'is_active' => 'boolean',
'name' => 'array',
'description' => 'array',
'live_show_token_rotated_at' => 'datetime',
];
protected static function booted(): void
@@ -152,6 +153,29 @@ class Event extends Model
return $this->eventPackage->canUploadPhoto();
}
public function ensureLiveShowToken(): string
{
if (is_string($this->live_show_token) && $this->live_show_token !== '') {
return $this->live_show_token;
}
return $this->rotateLiveShowToken();
}
public function rotateLiveShowToken(): string
{
do {
$token = bin2hex(random_bytes(32));
} while (self::query()->where('live_show_token', $token)->exists());
$this->forceFill([
'live_show_token' => $token,
'live_show_token_rotated_at' => now(),
])->save();
return $token;
}
public function getSettingsAttribute($value): array
{
if (is_array($value)) {