*/ class VarietyVariationFactory extends Factory { protected $model = VarietyVariation::class; /** * Define the model's default state. * * @return array */ public function definition(): array { $colors = ['green', 'blue', 'yellow', 'red']; $statuses = ['active', 'inactive']; $ripeningPeriods = [ 'Early September', 'Mid-September', 'Late September', 'Early October', 'Mid-October', 'Late October', 'September - early October', 'Late September - mid-October' ]; return [ 'grape_variety_id' => GrapeVariety::factory(), 'color' => fake()->randomElement($colors), 'description' => fake()->sentence(8), 'typical_sugar_content' => fake()->randomFloat(2, 16.0, 25.0), 'typical_alcohol' => fake()->randomFloat(2, 10.0, 14.5), 'ripening_period' => fake()->randomElement($ripeningPeriods), 'status' => fake()->randomElement($statuses), ]; } /** * Indicate that the variation is active. */ public function active(): static { return $this->state(fn (array $attributes) => [ 'status' => 'active', ]); } /** * Indicate that the variation is inactive. */ public function inactive(): static { return $this->state(fn (array $attributes) => [ 'status' => 'inactive', ]); } }