Build & Deploy / build (push) Successful in 18s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Functional\Programs\Database\Factories;
|
|
|
|
use Functional\Programs\Models\Program;
|
|
use Functional\Programs\Models\ProgramSlot;
|
|
use Functional\Routines\Models\Routine;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<ProgramSlot>
|
|
*/
|
|
class ProgramSlotFactory extends Factory
|
|
{
|
|
protected $model = ProgramSlot::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
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',
|
|
]);
|
|
}
|
|
}
|