From 19ffc1702f64e96cbbae25497b479b798e213b1b Mon Sep 17 00:00:00 2001 From: fthvgb1 Date: Sat, 2 Jun 2018 23:58:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/User.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Models/User.php b/app/Models/User.php index 08dc6df..60d45ba 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -46,7 +46,9 @@ class User extends Authenticatable */ 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)