invoiceninja/app/Models/Traits/UserTrait.php
2018-10-15 23:40:34 +11:00

34 lines
No EOL
610 B
PHP

<?php
namespace App\Models\Traits;
trait UserTrait
{
/**
* @return mixed|string
*/
public function getDisplayName()
{
if ($this->getFullName()) {
return $this->getFullName();
} elseif ($this->email) {
return $this->email;
} else {
return trans('texts.guest');
}
}
/**
* @return string
*/
public function getFullName()
{
if ($this->first_name || $this->last_name) {
return $this->first_name.' '.$this->last_name;
} else {
return '';
}
}
}