Add participants parent id
This commit is contained in:
parent
43846d1703
commit
a0842afd47
|
@ -119,7 +119,7 @@ class NamiField extends Field
|
|||
}
|
||||
|
||||
$data[$this->key] = [];
|
||||
$form->participants()->create(['data' => $data, 'mitgliedsnr' => $memberData['id']]);
|
||||
$form->participants()->create(['data' => $data, 'mitgliedsnr' => $memberData['id'], 'parent_id' => $participant->id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ return new class extends Migration
|
|||
$table->id();
|
||||
$table->json('data');
|
||||
$table->foreignId('form_id');
|
||||
$table->foreignId('parent_id', 'participants')->nullable();
|
||||
$table->string('mitgliedsnr')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
@ -308,6 +308,7 @@ class FormRegisterActionTest extends FormTestCase
|
|||
|
||||
$this->register($form, ['email' => 'max@muster.de'])->assertOk();
|
||||
$this->assertNull($form->participants->first()->mitgliedsnr);
|
||||
$this->assertNull($form->participants->first()->parent_id);
|
||||
}
|
||||
|
||||
// --------------------------- NamiField Tests ---------------------------
|
||||
|
@ -329,6 +330,8 @@ class FormRegisterActionTest extends FormTestCase
|
|||
$this->assertEquals([['id' => '5505'], ['id' => '5506']], $form->participants->get(0)->data['members']);
|
||||
$this->assertEquals([], $form->participants->get(1)->data['members']);
|
||||
$this->assertEquals([], $form->participants->get(2)->data['members']);
|
||||
$this->assertEquals($form->participants->get(0)->id, $form->participants->get(2)->parent_id);
|
||||
$this->assertEquals($form->participants->get(0)->id, $form->participants->get(1)->parent_id);
|
||||
}
|
||||
|
||||
protected function memberMatchingDataProvider(): Generator
|
||||
|
|
Loading…
Reference in New Issue