From 354550b52e830d5c139ef259c1c9a03838aaa2ef Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 21 Aug 2023 20:11:17 +0100 Subject: [PATCH] Removed getCompleteNameAttribute(), modified getFullNameAttribute() Signed-off-by: snipe --- app/Models/User.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) 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 - * @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; }