Trimmed long names in header

Fixes #87
This commit is contained in:
Dan Brown
2016-03-30 21:28:38 +01:00
parent 097d9c9f3c
commit 8b109bac13
3 changed files with 18 additions and 7 deletions

View File

@ -162,4 +162,19 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
{
return '/settings/users/' . $this->id;
}
/**
* Get a shortened version of the user's name.
* @param int $chars
* @return string
*/
public function getShortName($chars = 8)
{
if (strlen($this->name) <= $chars) return $this->name;
$splitName = explode(' ', $this->name);
if (strlen($splitName[0]) <= $chars) return $splitName[0];
return '';
}
}