table member dan table benefit

This commit is contained in:
pajri
2022-12-20 17:48:28 +07:00
parent da14589328
commit 88ad144921
17 changed files with 1365 additions and 499 deletions

View File

@@ -107,4 +107,27 @@ class Person extends Model
{
return $this->morphMany(AppointmentParticipant::class, 'participantable');
}
public function setGenderAttribute($value)
{
if ($value == "M" || $value == "L") {
return $this->attributes['gender'] = "male";
} else if ($value == "F" || $value == "P") {
return $this->attributes['gender'] = "female";
} else {
return $this->attributes['gender'] = $value;
}
}
public function getGenderAttribute()
{
if ($this->attributes['gender'] == "male" || $this->attributes['gender'] == "L") {
return "male";
} else if ($this->attributes['gender'] == "female" || $this->attributes['gender'] == "P") {
return "female";
} else {
return "other";
}
}
}