update fix member detail
This commit is contained in:
@@ -71,6 +71,9 @@ class Member extends Model
|
||||
'full_name',
|
||||
'age',
|
||||
'gender_code',
|
||||
'relations',
|
||||
'status_marital'
|
||||
// 'relation_with_principal'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
@@ -245,7 +248,7 @@ class Member extends Model
|
||||
protected function genderCode(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => $this->gender ? ($this->gender == 'female' ? 'F' : 'M') : $this->gender
|
||||
get: fn () => $this->gender ? ($this->gender == 'Female' ? 'F' : 'M') : $this->gender
|
||||
);
|
||||
}
|
||||
|
||||
@@ -256,6 +259,39 @@ class Member extends Model
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
protected function relations(): Attribute
|
||||
{
|
||||
$relation = '-';
|
||||
if ($this->relation_with_principal == 'H'){
|
||||
$relation = 'Husbund';
|
||||
} else if ($this->relation_with_principal == 'W'){
|
||||
$relation = 'Wife';
|
||||
} else if ($this->relation_with_principal == 'S'){
|
||||
$relation = 'Son';
|
||||
} else if ($this->relation_with_principal == 'D'){
|
||||
$relation = 'Daughter';
|
||||
}
|
||||
return Attribute::make(
|
||||
get: fn () => $relation
|
||||
);
|
||||
}
|
||||
|
||||
protected function statusMarital(): Attribute
|
||||
{
|
||||
$maritalStatus = '-';
|
||||
if ($this->marital_status == 'M'){
|
||||
$maritalStatus = 'Married';
|
||||
} else if ($this->relation_with_principal == 'D'){
|
||||
$maritalStatus = 'Divorced';
|
||||
} else if ($this->relation_with_principal == 'S'){
|
||||
$maritalStatus = 'Sungle';
|
||||
}
|
||||
return Attribute::make(
|
||||
get: fn () => $maritalStatus
|
||||
);
|
||||
}
|
||||
|
||||
// protected function birthDate(): Attribute
|
||||
// {
|
||||
// // $date = $this->person->birth_date ?? ($this->birth_date ?? null);
|
||||
@@ -302,12 +338,31 @@ class Member extends Model
|
||||
);
|
||||
}
|
||||
|
||||
protected function gender(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => ucfirst($this->person->gender) ?? null
|
||||
);
|
||||
}
|
||||
// protected function relationWithPrincipal(): Attribute
|
||||
// {
|
||||
// $relation = null;
|
||||
|
||||
// if ($this->relation_with_principal === 'S') {
|
||||
// $relation = 'Son';
|
||||
// } elseif ($this->relation_with_principal === 'H') {
|
||||
// $relation = 'Husband';
|
||||
// } elseif ($this->relation_with_principal === 'D') {
|
||||
// $relation = 'Daughter';
|
||||
// } elseif ($this->relation_with_principal === 'Wife') {
|
||||
// $relation = 'Wife';
|
||||
// }
|
||||
|
||||
// return Attribute::make(
|
||||
// get: fn () => $relation
|
||||
// );
|
||||
// }
|
||||
|
||||
// protected function gender(): Attribute
|
||||
// {
|
||||
// return Attribute::make(
|
||||
// get: fn () => ucfirst($this->person->gender) ?? null
|
||||
// );
|
||||
// }
|
||||
|
||||
protected function corporateLogo(): Attribute
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user