Compare commits
No commits in common. "49afcafbb26efbf7f5483971409a40a506b02d60" and "af6dd35a5bcff4e112fd521a2afe0ecfa98252ed" have entirely different histories.
49afcafbb2
...
af6dd35a5b
|
@ -65,7 +65,7 @@ class GroupField extends Field
|
||||||
$rules[] = Rule::in(Group::find($this->parentGroup)->children()->pluck('id')->push(-1));
|
$rules[] = Rule::in(Group::find($this->parentGroup)->children()->pluck('id')->push(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->parentField && request()->input($this->parentField) && request()->input($this->parentField) !== -1) {
|
if ($this->parentField && request()->input($this->parentField)) {
|
||||||
$rules[] = Rule::in(Group::find(request()->input($this->parentField))->children()->pluck('id')->push(-1));
|
$rules[] = Rule::in(Group::find(request()->input($this->parentField))->children()->pluck('id')->push(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit bd4118040fd2643b71f7f152ca2668f2097820a2
|
Subproject commit 41adb7ecb0f95353c80745f050781b50a68b3a31
|
|
@ -344,22 +344,6 @@ class FormRegisterActionTest extends FormTestCase
|
||||||
->assertJsonValidationErrors(['group' => 'Der gewählte Wert für Gruppe ist ungültig.']);
|
->assertJsonValidationErrors(['group' => 'Der gewählte Wert für Gruppe ist ungültig.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGroupFieldCanBeUnsetWhenGiven(): void
|
|
||||||
{
|
|
||||||
$this->login()->loginNami();
|
|
||||||
$group = Group::factory()->has(Group::factory(), 'children')->create();
|
|
||||||
$form = Form::factory()->fields([
|
|
||||||
$this->groupField('region')->emptyOptionValue('kein Bezirk')->parentGroup($group->id)->required(false),
|
|
||||||
$this->groupField('stamm')->name('Gruppe')->emptyOptionValue('kein Stamm')->parentField('region')->required(true)
|
|
||||||
])
|
|
||||||
->create();
|
|
||||||
|
|
||||||
$this->register($form, ['region' => -1, 'stamm' => -1])->assertOk();
|
|
||||||
$participants = $form->fresh()->participants;
|
|
||||||
$this->assertEquals(-1, $participants->first()->data['region']);
|
|
||||||
$this->assertEquals(-1, $participants->first()->data['stamm']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGroupFieldCanBeNullWhenNotRequired(): void
|
public function testGroupFieldCanBeNullWhenNotRequired(): void
|
||||||
{
|
{
|
||||||
$this->login()->loginNami();
|
$this->login()->loginNami();
|
||||||
|
|
Loading…
Reference in New Issue