Browse Source

If discord is connected, use discord avatar instead of gravatar

Dennis 3 years ago
parent
commit
228d55c389
1 changed files with 6 additions and 1 deletions
  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;
     }
 
     /**