Update Profile model, use cdn_url for avatars

This commit is contained in:
Daniel Supernault 2021-01-25 21:39:10 -07:00
parent 9eafc31e6f
commit ea8e426174
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 9 additions and 0 deletions

View File

@ -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}";