*/ class TaskFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'title' => $this->faker->sentence(3), 'is_done' => $this->faker->boolean(30), 'due_at' => $this->faker->optional()->dateTimeBetween('-1 month', '+1 month'), ]; } public function done(): self { return $this->state(fn() => ['is_done' => true]); } }