ucfirst($faker->words(2, true)), 'description' => $faker->sentence(), 'type' => 'category', 'parent_id' => null, 'position' => $categoryIndex, ]); $subcategoryCount = $faker->numberBetween(1, 5); for ($subIndex = 1; $subIndex <= $subcategoryCount; $subIndex += 1) { $subcategory = Forum::create([ 'name' => ucfirst($faker->words(2, true)), 'description' => $faker->sentence(), 'type' => 'category', 'parent_id' => $category->id, 'position' => $subIndex, ]); $subForumCount = $faker->numberBetween(1, 5); for ($forumIndex = 1; $forumIndex <= $subForumCount; $forumIndex += 1) { Forum::create([ 'name' => ucfirst($faker->words(3, true)), 'description' => $faker->sentence(), 'type' => 'forum', 'parent_id' => $subcategory->id, 'position' => $forumIndex, ]); } } $forumCount = $faker->numberBetween(3, 10); for ($forumIndex = 1; $forumIndex <= $forumCount; $forumIndex += 1) { Forum::create([ 'name' => ucfirst($faker->words(3, true)), 'description' => $faker->sentence(), 'type' => 'forum', 'parent_id' => $category->id, 'position' => $subcategoryCount + $forumIndex, ]); } } } }