1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Added user avatars. Fixes #20

This commit is contained in:
Dan Brown
2015-08-23 13:41:35 +01:00
parent 7b65ba49f6
commit 958ed627dd
9 changed files with 88 additions and 22 deletions

View File

@ -32,4 +32,16 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
* @var array
*/
protected $hidden = ['password', 'remember_token'];
/**
* Returns the user's avatar,
* Uses Gravatar as the avatar service.
* @param int $size
* @return string
*/
public function getAvatar($size = 50)
{
$emailHash = md5(strtolower(trim($this->email)));
return '//www.gravatar.com/avatar/' . $emailHash . '?s=' . $size . '&d=identicon';
}
}