*/ class UserDishRecurrenceFactory extends Factory { public function definition(): array { return [ 'user_dish_id' => null, 'recurrence_id' => null, 'recurrence_type' => null, ]; } public function userDish(UserDish $userDish): self { return $this->state(fn (array $attributes) => [ 'user_dish_id' => $userDish->id, ]); } public function recurrence(RecurrenceInterface $recurrence): self { return $this->state(fn (array $attributes) => [ 'recurrence_id' => $recurrence->id, 'recurrence_type' => $recurrence::class, ]); } }