Fix SQL & Member Eloquent

This commit is contained in:
Muhammad Fajar
2024-01-06 13:52:41 +07:00
parent 494c13aea8
commit eb662f7c34
3 changed files with 14 additions and 3 deletions

View File

@@ -213,15 +213,25 @@ class Member extends Model
$arr[] = $this->person->name_prefix;
}
$arr[] = $this->person->name ?? '-';
$arr[] = $this->person->name;
if (!empty($this->person->name_suffix)) {
$arr[] = $this->person->name_suffix;
}
} else {
if (!empty($this->name_prefix)) {
$arr[] = $this->name_prefix;
}
$arr[] = $this->name;
if (!empty($this->name_suffix)) {
$arr[] = $this->name_suffix;
}
}
return Attribute::make(
get: fn () => !empty($arr) ? ucwords(strtolower(implode(' ', $arr))) : null
get: fn () => $arr ? ucwords(strtolower(implode(' ', $arr))) : null
);
}