34 lines
No EOL
610 B
PHP
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 '';
|
|
}
|
|
}
|
|
|
|
} |