faker->unique()->words(rand(2, 4), true); $type = $this->faker->numberBetween(1, count(collect(AdviceTypeEnum::toArray())) - 1); if ($type == AdviceTypeEnum::recipes()->value) { $cooking_time = $this->faker->numberBetween(0, 10); $preparation_time = $this->faker->numberBetween(0, 10); } else { $cooking_time = null; $preparation_time = null; } $ingredients = []; for ($jj = 1; $jj <= 15; $jj++) { array_push($ingredients, [ "value" => $this->faker->numberBetween(6, 300), "label" => $this->faker->unique()->words(rand(2, 8), true), ]); } return [ 'title' => $title, 'slug' => Str::slug($title), 'type' => $type, 'picture_title' => $this->faker->words(5, true), 'picture_alt' => $this->faker->words(8, true), 'sticker_title' => $this->faker->words(5, true), 'sticker_alt' => $this->faker->words(8, true), 'sticker_sm_title' => $this->faker->words(5, true), 'sticker_sm_alt' => $this->faker->words(8, true), 'preparation' => $this->faker->words(25, true), 'advice' => $this->faker->words(25, true), 'ingredients' => $ingredients, 'preparation' => $this->faker->words(25, true), 'guests_nb' => $this->faker->boolean(50) ? rand(0, 10) : null, 'youtube_video_id' => $this->faker->boolean(50) ? '7rpgfetac0U' : null, 'cooking_time' => $this->faker->boolean(50) ? $cooking_time : null, 'preparation_time' => $this->faker->boolean(50) ? $preparation_time : null, 'difficulty' => $this->faker->boolean(50) ? collect(AdviceDifficultyEnum::toArray())->random() : null, 'status' => $this->faker->boolean(75) ]; } }