]> _ Git - cubedesigners_userdatabase.git/commitdiff
wip #3753 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Dec 2020 19:36:35 +0000 (20:36 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Dec 2020 19:36:35 +0000 (20:36 +0100)
src/User.php

index a63bc2eebd5aaccdd764f217b05b4fe62992ba63..393dec09ca5ebaca3555907e17d3f182c6d93ee1 100644 (file)
@@ -82,7 +82,7 @@ class User extends CubistMagicAuthenticatable
         if ($name === '') {
             return $this->companyName;
         }
-        return $this->companyName . ' - ' . $this->name;
+        return $this->companyName . ' (' . $this->name . ')';
     }
 
     public function getNameWithCompanyAttribute()
@@ -94,6 +94,20 @@ class User extends CubistMagicAuthenticatable
         return $name . ' (' . $this->companyName . ')';
     }
 
+    public function getCompanyWithNameOnTwoLinesAttribute()
+    {
+        $name = $this->name;
+        if ($name === '') {
+            return $this->companyName;
+        }
+        $company = $this->companyName;
+        if (mb_strlen($company) > 30) {
+            $company = '<span title="' . $company . '">' . mb_substr($company, 0, 27) . '...</span>';
+        }
+
+        return $company . '<br><em>' . $name . '</em>';
+    }
+
     public function getCompanyNameAttribute()
     {
         return self::_getCompanyNames($this->company);