From: Vincent Vanwaelscappel Date: Thu, 10 Dec 2020 19:36:35 +0000 (+0100) Subject: wip #3753 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=9a38a167eb463cf260094b3c88e2cfb94bab32d8;p=cubedesigners_userdatabase.git wip #3753 @0.5 --- diff --git a/src/User.php b/src/User.php index a63bc2e..393dec0 100644 --- a/src/User.php +++ b/src/User.php @@ -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 = '' . mb_substr($company, 0, 27) . '...'; + } + + return $company . '
' . $name . ''; + } + public function getCompanyNameAttribute() { return self::_getCompanyNames($this->company);