*/ class RoutineFactory extends Factory { protected $model = Routine::class; /** * Define the model's default state. * * @return array */ public function definition(): array { $name = fake()->randomElement([ 'Full body débutant', 'Push day', 'Pull day', 'Leg day', 'Upper body', 'Circuit HIIT', 'Force 5x5', 'Hypertrophie bras', 'Core & mobilité', ]) . ' ' . fake()->numberBetween(1, 9); return [ 'user_id' => User::factory(), 'name' => $name, 'slug' => Str::slug($name) . '-' . fake()->unique()->numberBetween(1000, 9999), 'description' => fake()->boolean(70) ? fake()->sentence(12) : null, 'is_public' => fake()->boolean(30), 'estimated_minutes' => fake()->optional(0.8)->numberBetween(20, 90), ]; } /** Routine partagée publiquement (visible du catalogue communautaire). */ public function public(): static { return $this->state(fn (array $attributes) => ['is_public' => true]); } /** Routine privée, réservée à son propriétaire. */ public function private(): static { return $this->state(fn (array $attributes) => ['is_public' => false]); } }