浏览代码

If discord is connected, use discord avatar instead of gravatar

Dennis 3 年之前
父节点
当前提交
228d55c389
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      app/Models/User.php

+ 6 - 1
app/Models/User.php

@@ -213,7 +213,12 @@ class User extends Authenticatable implements MustVerifyEmail
      */
     public function getAvatar()
     {
-        return "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->email)));
+        if ($this->discordUser()->exists()){
+            $avatar = $this->discordUser->getAvatar();
+        }else{
+            $avatar = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->email)));
+        }
+        return $avatar;
     }
 
     /**