Added opaque join-token support across backend and frontend: new migration/model/service/endpoints, guest controllers now resolve tokens, and the demo seeder seeds a token. Tenant event details list/manage tokens with copy/revoke actions, and the guest PWA uses tokens end-to-end (routing, storage, uploads, achievements, etc.). Docs TODO updated to reflect completed steps.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('event_join_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('event_id')
|
||||
->constrained()
|
||||
->cascadeOnDelete();
|
||||
$table->string('token', 64)->unique();
|
||||
$table->string('label')->nullable();
|
||||
$table->unsignedInteger('usage_limit')->nullable();
|
||||
$table->unsignedInteger('usage_count')->default(0);
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamp('revoked_at')->nullable();
|
||||
$table->foreignId('created_by')->nullable()
|
||||
->constrained('users')
|
||||
->nullOnDelete();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['event_id', 'revoked_at']);
|
||||
$table->index(['revoked_at', 'expires_at']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('event_join_tokens');
|
||||
}
|
||||
};
|
||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\{Event, EventType};
|
||||
use App\Services\EventJoinTokenService;
|
||||
|
||||
class DemoEventSeeder extends Seeder
|
||||
{
|
||||
@@ -13,7 +14,7 @@ class DemoEventSeeder extends Seeder
|
||||
if(!$type){ return; }
|
||||
$demoTenant = \App\Models\Tenant::where('slug', 'demo')->first();
|
||||
if (!$demoTenant) { return; }
|
||||
Event::updateOrCreate(['slug'=>'demo-wedding-2025'], [
|
||||
$event = Event::updateOrCreate(['slug'=>'demo-wedding-2025'], [
|
||||
'tenant_id' => $demoTenant->id,
|
||||
'name' => ['de'=>'Demo Hochzeit 2025','en'=>'Demo Wedding 2025'],
|
||||
'description' => ['de'=>'Demo-Event','en'=>'Demo event'],
|
||||
@@ -24,5 +25,13 @@ class DemoEventSeeder extends Seeder
|
||||
'settings' => json_encode([]),
|
||||
'default_locale' => 'de',
|
||||
]);
|
||||
|
||||
if ($event->joinTokens()->count() === 0) {
|
||||
/** @var EventJoinTokenService $service */
|
||||
$service = app(EventJoinTokenService::class);
|
||||
$service->createToken($event, [
|
||||
'label' => 'Demo QR',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user