update ecard dan enrolment 2

This commit is contained in:
2024-01-06 12:35:58 +07:00
parent a9c48f63a4
commit 5c5ad8bae7
3 changed files with 23 additions and 11 deletions

View File

@@ -268,10 +268,20 @@ class Member extends Model
protected function birthDateeCard(): Attribute
{
// $date = $this->person->birth_date ?? ($this->birth_date ?? null);
$date = $this->birth_date ?? ($this->birth_date ?? this->person->birth_date);
return Attribute::make(
get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null
);
if ($this->birth_date){
$date = $this->birth_date;
return Attribute::make(
get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null
);
} else if ($this->person->birth_date){
return Attribute::make(
get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null
);
} else {
return Attribute::make(
get: fn () => '-'
);
}
}
protected function startDate(): Attribute