Fotospiel GmbH entfernt, Jon Token des demo events gefixt + demoeventseeder. Favicon auf ".ico" gesetzt.
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Models\Task;
|
||||
use App\Models\TaskCollection;
|
||||
use App\Models\Tenant;
|
||||
use App\Services\EventJoinTokenService;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@@ -41,6 +42,7 @@ class DemoEventSeeder extends Seeder
|
||||
'event_type' => $weddingType,
|
||||
'package' => $standardPackage,
|
||||
'token_label' => 'Demo QR',
|
||||
'token_value' => 'W2E3sbt7yclzpkAwNSARHYTVN1sPLBad8hfUjLVHmjkUviPd',
|
||||
'collection_slugs' => ['wedding-classics-2025'],
|
||||
'task_slug_prefix' => 'wedding-',
|
||||
'branding' => [
|
||||
@@ -91,7 +93,7 @@ class DemoEventSeeder extends Seeder
|
||||
]
|
||||
);
|
||||
|
||||
$this->ensureJoinToken($event, $config['token_label']);
|
||||
$this->ensureJoinToken($event, $config['token_label'], $config['token_value'] ?? null);
|
||||
|
||||
$this->attachEventPackage(
|
||||
event: $event,
|
||||
@@ -106,13 +108,31 @@ class DemoEventSeeder extends Seeder
|
||||
}
|
||||
}
|
||||
|
||||
private function ensureJoinToken(Event $event, string $label): void
|
||||
private function ensureJoinToken(Event $event, string $label, ?string $token = null): void
|
||||
{
|
||||
if ($event->joinTokens()->exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
app(EventJoinTokenService::class)->createToken($event, ['label' => $label]);
|
||||
$attributes = ['label' => $label];
|
||||
|
||||
if ($token) {
|
||||
$attributes['metadata'] = ['seeded' => true, 'plain_token' => $token];
|
||||
}
|
||||
|
||||
$tokenModel = app(EventJoinTokenService::class)->createToken($event, $attributes);
|
||||
|
||||
if ($token) {
|
||||
$hash = hash('sha256', $token);
|
||||
$preview = strlen($token) <= 10 ? $token : substr($token, 0, 6).'…'.substr($token, -4);
|
||||
|
||||
$tokenModel->forceFill([
|
||||
'token' => $hash,
|
||||
'token_hash' => $hash,
|
||||
'token_encrypted' => Crypt::encryptString($token),
|
||||
'token_preview' => $preview,
|
||||
])->save();
|
||||
}
|
||||
}
|
||||
|
||||
private function attachEventPackage(Event $event, Package $package, Tenant $tenant, string $providerId, Carbon $purchasedAt): void
|
||||
|
||||
Reference in New Issue
Block a user