Fixed: subscription_id validation
This commit is contained in:
parent
3a96b00307
commit
dc832503b4
|
@ -41,6 +41,10 @@ class MemberRequest extends FormRequest
|
||||||
'first_subactivity' => 'exclude|required',
|
'first_subactivity' => 'exclude|required',
|
||||||
] : [],
|
] : [],
|
||||||
'subscription_id' => Rule::requiredIf(function () {
|
'subscription_id' => Rule::requiredIf(function () {
|
||||||
|
if (!$this->input('has_nami')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ('POST' != $this->method()) {
|
if ('POST' != $this->method()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ class StoreTest extends TestCase
|
||||||
'zip' => null,
|
'zip' => null,
|
||||||
'location' => null,
|
'location' => null,
|
||||||
'joined_at' => null,
|
'joined_at' => null,
|
||||||
]));
|
]))->assertSessionDoesntHaveErrors();
|
||||||
$this->assertDatabaseHas('members', [
|
$this->assertDatabaseHas('members', [
|
||||||
'nationality_id' => null,
|
'nationality_id' => null,
|
||||||
'birthday' => null,
|
'birthday' => null,
|
||||||
|
@ -165,6 +165,20 @@ class StoreTest extends TestCase
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testItDoesntNeedSubscription(): void
|
||||||
|
{
|
||||||
|
$this->login()->loginNami();
|
||||||
|
|
||||||
|
$this
|
||||||
|
->post('/member', $this->attributes([
|
||||||
|
'has_nami' => false,
|
||||||
|
'subscription_id' => null,
|
||||||
|
]))->assertSessionDoesntHaveErrors();
|
||||||
|
$this->assertDatabaseHas('members', [
|
||||||
|
'subscription_id' => null,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function testItRequiresFields(): void
|
public function testItRequiresFields(): void
|
||||||
{
|
{
|
||||||
$this->login()->loginNami();
|
$this->login()->loginNami();
|
||||||
|
|
Loading…
Reference in New Issue