Add joined at attribute

This commit is contained in:
philipp lang 2020-06-30 00:07:53 +02:00
parent 431dfb68fe
commit 6997ff07f1
2 changed files with 8 additions and 2 deletions

View File

@ -26,7 +26,8 @@ class Member extends Model {
'emailVertretungsberechtigter' => 'email_parents',
'staatsangehoerigkeitId' => 'nationality_id',
'konfessionId' => 'confession_id',
'geburtsDatum' => 'birthday'
'geburtsDatum' => 'birthday',
'eintrittsdatum' => 'joined_at',
];
protected $guarded = [];
@ -49,6 +50,10 @@ class Member extends Model {
return Carbon::parse($this->attributes['birthday'])->format('Y-m-d');
}
public function getJoinedAtAttribute() {
return Carbon::parse($this->attributes['joined_at'])->format('Y-m-d');
}
public function getGenderIdAttribute() {
return $this->attributes['gender_id'] == Gender::getNullValue() ? null : $this->attributes['gender_id'];
}

View File

@ -33,7 +33,8 @@ class PullMemberTest extends TestCase
'gender_id' => ['gender_id', [19, null]],
'nationality_id' => ['nationality_id', [1054, null]],
'confession_id' => ['confession_id', [1, null]],
'birthday' => ['birthday', ['1991-06-20', '1984-01-17']]
'birthday' => ['birthday', ['1991-06-20', '1984-01-17']],
'joined_at' => ['joined_at', ['2005-05-01', '2003-11-17']],
];
}