Skip to content

A free open source IT asset/license management system

Removed getCompleteNameAttribute(), modified getFullNameAttribute()

snipe354550b52e83
diff --git a/app/Models/User.php b/app/Models/User.php
index 98a3ec346b..0d49b977c4 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -247,21 +247,12 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
*/
public function getFullNameAttribute()
{
- return $this->first_name.' '.$this->last_name;
- }
+ $setting = Setting::getSettings();
- /**
- * Returns the complete name attribute with username
- *
- * @todo refactor this so it's less repetitive and dumb
- *
- * @author A. Gianotto <[email protected]>
- * @since [v2.0]
- * @return string
- */
- public function getCompleteNameAttribute()
- {
- return $this->last_name.', '.$this->first_name.' ('.$this->username.')';
+ if ($setting->name_display_format=='last_first') {
+ return ($this->last_name) ? $this->last_name.' '.$this->first_name : $this->first_name;
+ }
+ return $this->last_name ? $this->first_name.' '.$this->last_name : $this->first_name;
}