Adde 'fullName' method to the Person model to achieve the full name as string.

This commit is contained in:
Lukas Halbritter
2018-09-13 15:57:40 +02:00
parent 1b10f45a7d
commit 47569b0525
+14
View File
@@ -126,4 +126,18 @@ class Person extends Model
{ {
return $this->hasManyThrough('\App\SubBooking', '\App\PersonTarget'); return $this->hasManyThrough('\App\SubBooking', '\App\PersonTarget');
} }
/*
* Get the full name of the person.
*
* @return string
*/
public function fullName()
{
if ($this->title == 'Firma') {
return $this->name_or_company;
} else {
return $this->surname . ' ' . $this->name_or_company;
}
}
} }