Add: Get birthday from member
This commit is contained in:
parent
5a4fa4d5ec
commit
431dfb68fe
|
@ -2,18 +2,11 @@
|
||||||
|
|
||||||
namespace Zoomyboy\LaravelNami;
|
namespace Zoomyboy\LaravelNami;
|
||||||
|
|
||||||
use \ArrayAccess;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
use Illuminate\Database\Eloquent\Concerns\HasAttributes;
|
|
||||||
use Illuminate\Database\Eloquent\Concerns\HidesAttributes;
|
|
||||||
use Illuminate\Contracts\Support\Arrayable;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Member extends Model {
|
class Member extends Model {
|
||||||
|
|
||||||
use HasAttributes;
|
|
||||||
use HidesAttributes;
|
|
||||||
|
|
||||||
protected static $overviewAttributes = [
|
protected static $overviewAttributes = [
|
||||||
'vorname' => 'firstname',
|
'vorname' => 'firstname',
|
||||||
'nachname' => 'lastname',
|
'nachname' => 'lastname',
|
||||||
|
@ -32,7 +25,8 @@ class Member extends Model {
|
||||||
'geschlechtId' => 'gender_id',
|
'geschlechtId' => 'gender_id',
|
||||||
'emailVertretungsberechtigter' => 'email_parents',
|
'emailVertretungsberechtigter' => 'email_parents',
|
||||||
'staatsangehoerigkeitId' => 'nationality_id',
|
'staatsangehoerigkeitId' => 'nationality_id',
|
||||||
'konfessionId' => 'confession_id'
|
'konfessionId' => 'confession_id',
|
||||||
|
'geburtsDatum' => 'birthday'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
@ -51,6 +45,10 @@ class Member extends Model {
|
||||||
parent::__construct($member);
|
parent::__construct($member);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBirthdayAttribute() {
|
||||||
|
return Carbon::parse($this->attributes['birthday'])->format('Y-m-d');
|
||||||
|
}
|
||||||
|
|
||||||
public function getGenderIdAttribute() {
|
public function getGenderIdAttribute() {
|
||||||
return $this->attributes['gender_id'] == Gender::getNullValue() ? null : $this->attributes['gender_id'];
|
return $this->attributes['gender_id'] == Gender::getNullValue() ? null : $this->attributes['gender_id'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ class PullMemberTest extends TestCase
|
||||||
'gender_id' => ['gender_id', [19, null]],
|
'gender_id' => ['gender_id', [19, null]],
|
||||||
'nationality_id' => ['nationality_id', [1054, null]],
|
'nationality_id' => ['nationality_id', [1054, null]],
|
||||||
'confession_id' => ['confession_id', [1, null]],
|
'confession_id' => ['confession_id', [1, null]],
|
||||||
|
'birthday' => ['birthday', ['1991-06-20', '1984-01-17']]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue