where('slug', 'demo-wedding-2025')->value('id'); if (!$demoEventId) { $this->command->info('Demo event not found, skipping task collections seeding'); return; } // Get some task IDs for demo (assuming TasksSeeder was run) $taskIds = DB::table('tasks')->limit(6)->pluck('id')->toArray(); if (empty($taskIds)) { $this->command->info('No tasks found, skipping task collections seeding'); return; } // Create Wedding Task Collection $weddingCollectionId = DB::table('task_collections')->insertGetId([ 'name' => json_encode([ 'de' => 'Hochzeitsaufgaben', 'en' => 'Wedding Tasks' ]), 'description' => json_encode([ 'de' => 'Spezielle Aufgaben für Hochzeitsgäste', 'en' => 'Special tasks for wedding guests' ]), ]); // Assign first 4 tasks to wedding collection $weddingTasks = array_slice($taskIds, 0, 4); foreach ($weddingTasks as $taskId) { DB::table('task_collection_task')->insert([ 'task_collection_id' => $weddingCollectionId, 'task_id' => $taskId, ]); } // Link wedding collection to demo event DB::table('event_task_collection')->insert([ 'event_id' => $demoEventId, 'task_collection_id' => $weddingCollectionId, 'sort_order' => 1, ]); // Create General Fun Tasks Collection (fallback) $funCollectionId = DB::table('task_collections')->insertGetId([ 'name' => json_encode([ 'de' => 'Spaß-Aufgaben', 'en' => 'Fun Tasks' ]), 'description' => json_encode([ 'de' => 'Allgemeine unterhaltsame Aufgaben', 'en' => 'General entertaining tasks' ]), ]); // Assign remaining tasks to fun collection $funTasks = array_slice($taskIds, 4); foreach ($funTasks as $taskId) { DB::table('task_collection_task')->insert([ 'task_collection_id' => $funCollectionId, 'task_id' => $taskId, ]); } // Link fun collection to demo event as fallback DB::table('event_task_collection')->insert([ 'event_id' => $demoEventId, 'task_collection_id' => $funCollectionId, 'sort_order' => 2, ]); $this->command->info("✅ Created 2 task collections with " . count($taskIds) . " tasks for demo event"); $this->command->info("Wedding Collection ID: {$weddingCollectionId}"); $this->command->info("Fun Collection ID: {$funCollectionId}"); } }