The fullName() method is now able to return the name, but in the form 'LAST

NAME, FIRST NAME'.
This commit is contained in:
Lukas Halbritter
2018-10-04 20:34:26 +02:00
parent 201ffd3d7a
commit 1e9e90ec17
+8 -1
View File
@@ -70,14 +70,21 @@ class Person extends Model
/** /**
* Get the full name of the person. * Get the full name of the person.
* If $reverse is true, return a comma-spearated string of the name with the
* last name first.
* *
* @param boolean $reverse
* @return string * @return string
*/ */
public function fullName() public function fullName($reverse = false)
{ {
if ($this->title == 'Firma') { if ($this->title == 'Firma') {
return $this->name_or_company; return $this->name_or_company;
} else { } else {
if ($reverse) {
return $this->name_or_company . ', ' . $this->surname;
}
return $this->surname . ' ' . $this->name_or_company; return $this->surname . ' ' . $this->name_or_company;
} }
} }