From 47569b0525f390280189a602675be0cfc9812208 Mon Sep 17 00:00:00 2001 From: Lukas Halbritter Date: Thu, 13 Sep 2018 15:57:40 +0200 Subject: [PATCH] Adde 'fullName' method to the Person model to achieve the full name as string. --- app/Person.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Person.php b/app/Person.php index bc1957a..2a8e8b2 100644 --- a/app/Person.php +++ b/app/Person.php @@ -126,4 +126,18 @@ class Person extends Model { 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; + } + } }