Adde 'fullName' method to the Person model to achieve the full name as string.
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user