Changeset View
Changeset View
Standalone View
Standalone View
src/app/User.php
Show First 20 Lines • Show All 537 Lines • ▼ Show 20 Lines | class User extends Authenticatable implements JWTSubject | ||||
* A shortcut to get the user name. | * A shortcut to get the user name. | ||||
* | * | ||||
* @param bool $fallback Return "<aa.name> User" if there's no name | * @param bool $fallback Return "<aa.name> User" if there's no name | ||||
* | * | ||||
* @return string Full user name | * @return string Full user name | ||||
*/ | */ | ||||
public function name(bool $fallback = false): string | public function name(bool $fallback = false): string | ||||
{ | { | ||||
$firstname = $this->getSetting('first_name'); | $settings = $this->getSettings(['first_name', 'last_name']); | ||||
$lastname = $this->getSetting('last_name'); | |||||
$name = trim($firstname . ' ' . $lastname); | $name = trim($settings['first_name'] . ' ' . $settings['last_name']); | ||||
if (empty($name) && $fallback) { | if (empty($name) && $fallback) { | ||||
return \config('app.name') . ' User'; | return trim(\trans('app.siteuser', ['site' => \App\Tenant::getConfig($this->tenant_id, 'app.name')])); | ||||
} | } | ||||
return $name; | return $name; | ||||
} | } | ||||
/** | /** | ||||
* Remove a number of entitlements for the SKU. | * Remove a number of entitlements for the SKU. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 198 Lines • Show Last 20 Lines |