The fullName() method is now able to return the name, but in the form 'LAST
NAME, FIRST NAME'.
This commit is contained in:
+8
-1
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user