28 lines
563 B
PHP
28 lines
563 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Database\Factories;
|
||
|
|
|
||
|
|
use App\Models\WeeklyRecurrence;
|
||
|
|
use App\WeekdaysEnum;
|
||
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @extends Factory<WeeklyRecurrence>
|
||
|
|
*/
|
||
|
|
class WeeklyRecurrenceFactory extends Factory
|
||
|
|
{
|
||
|
|
public function definition(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'weekday' => fake()->randomElement(range(0, 7)),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function weekday(WeekdaysEnum $weekday): self
|
||
|
|
{
|
||
|
|
return $this->state(fn (array $attributes) => [
|
||
|
|
'weekday' => $weekday->value,
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|