默认头像

This commit is contained in:
fthvgb1 2018-06-02 23:58:22 +08:00
parent 34a4ccde2e
commit 19ffc1702f

View File

@ -46,7 +46,9 @@ class User extends Authenticatable
*/ */
public function getHeaderAttribute() public function getHeaderAttribute()
{ {
return asset($this->avatar); $hash = md5(strtolower(trim($this->attributes['email'])));
$header = "http://www.gravatar.com/avatar/$hash";
return $this->avatar ? asset($this->avatar) : $header;
} }
public function getLastActiveATAttribute($value) public function getLastActiveATAttribute($value)