diff --git a/app/Person.php b/app/Person.php index 8b6dfcf..338d200 100644 --- a/app/Person.php +++ b/app/Person.php @@ -70,14 +70,21 @@ class Person extends Model /** * 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 */ - public function fullName() + public function fullName($reverse = false) { if ($this->title == 'Firma') { return $this->name_or_company; } else { + if ($reverse) { + return $this->name_or_company . ', ' . $this->surname; + } + return $this->surname . ' ' . $this->name_or_company; } }