소스 검색

Update Profile model, use cdn_url for avatars

Daniel Supernault 4 년 전
부모
커밋
ea8e426174
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      app/Profile.php

+ 9 - 0
app/Profile.php

@@ -151,6 +151,15 @@ class Profile extends Model
     {
         $url = Cache::remember('avatar:'.$this->id, now()->addYears(1), function () {
             $avatar = $this->avatar;
+
+            if($avatar->cdn_url) {
+                return $avatar->cdn_url ?? url('/storage/avatars/default.jpg');
+            }
+
+            if($avatar->is_remote) {
+                return $avatar->cdn_url ?? url('/storage/avatars/default.jpg');
+            }
+            
             $path = $avatar->media_path;
             $path = "{$path}?v={$avatar->change_count}";