*/ class ProgramSlotFactory extends Factory { protected $model = ProgramSlot::class; /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'program_id' => Program::factory(), 'week' => fake()->numberBetween(1, 8), 'weekday' => fake()->numberBetween(1, 7), 'routine_id' => fake()->boolean(85) ? Routine::factory() : null, 'label' => fake()->optional(0.3)->randomElement(['Repos actif', 'Séance test', 'Deload']), ]; } /** Case de repos, sans routine associée. */ public function restDay(): static { return $this->state(fn (array $attributes) => [ 'routine_id' => null, 'label' => 'Repos', ]); } }