Fixed: Dont update member when no nami fields are filled
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
364952eae9
commit
651d69a538
|
@ -37,6 +37,8 @@ class Member extends Model
|
||||||
|
|
||||||
public $guarded = [];
|
public $guarded = [];
|
||||||
|
|
||||||
|
public static array $namiFields = ['firstname', 'lastname', 'joined_at', 'birthday', 'send_newspaper', 'address', 'zip', 'location', 'nickname', 'other_country', 'further_address', 'main_phone', 'mobile_phone', 'work_phone', 'fax', 'email', 'email_parents', 'gender_id', 'confession_id', 'region_id', 'country_id', 'fee_id', 'nationality_id'];
|
||||||
|
|
||||||
public $dates = ['try_created_at', 'joined_at', 'birthday'];
|
public $dates = ['try_created_at', 'joined_at', 'birthday'];
|
||||||
|
|
||||||
public $casts = [
|
public $casts = [
|
||||||
|
|
|
@ -79,12 +79,16 @@ class MemberRequest extends FormRequest
|
||||||
|
|
||||||
public function persistUpdate(Member $member): void
|
public function persistUpdate(Member $member): void
|
||||||
{
|
{
|
||||||
$member->update($this->validated());
|
$member->fill($this->validated());
|
||||||
|
|
||||||
|
$namiSync = $member->isDirty(Member::$namiFields);
|
||||||
|
|
||||||
|
$member->save();
|
||||||
|
|
||||||
if ($this->input('has_nami') && null === $member->nami_id) {
|
if ($this->input('has_nami') && null === $member->nami_id) {
|
||||||
CreateJob::dispatch($member);
|
CreateJob::dispatch($member);
|
||||||
}
|
}
|
||||||
if ($this->input('has_nami') && null !== $member->nami_id) {
|
if ($this->input('has_nami') && null !== $member->nami_id && $namiSync) {
|
||||||
UpdateJob::dispatch($member->fresh());
|
UpdateJob::dispatch($member->fresh());
|
||||||
}
|
}
|
||||||
if (!$this->input('has_nami') && null !== $member->nami_id) {
|
if (!$this->input('has_nami') && null !== $member->nami_id) {
|
||||||
|
|
Loading…
Reference in New Issue