*/ class ParticipantFactory extends Factory { /** * The name of the factory's corresponding model. * * @var class-string */ protected $model = Participant::class; /** * Define the model's default state. * * @return array */ public function definition() { return [ 'data' => [], ]; } /** * @param array $sections */ public function sections(array $sections): self { return $this->state(['config' => ['sections' => array_map(fn ($section) => $section->create(), $sections)]]); } /** * @param array $data */ public function data(array $data): self { return $this->state(['data' => $data]); } }