diff --git a/app/Services/AvatarService.php b/app/Services/AvatarService.php new file mode 100644 index 000000000..1c5e9e0c1 --- /dev/null +++ b/app/Services/AvatarService.php @@ -0,0 +1,23 @@ +avatarUrl(); + } +} diff --git a/app/User.php b/app/User.php index 980548d6d..3f826c143 100644 --- a/app/User.php +++ b/app/User.php @@ -7,6 +7,7 @@ use Illuminate\Notifications\Notifiable; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; use App\Util\RateLimit\User as UserRateLimit; +use App\Services\AvatarService; class User extends Authenticatable { @@ -97,4 +98,13 @@ class User extends Authenticatable return $this->hasMany(AccountInterstitial::class); } + public function avatarUrl() + { + if(!$this->profile_id || $this->status) { + return config('app.url') . '/storage/avatars/default.jpg'; + } + + return AvatarService::get($this->profile_id); + } + } diff --git a/resources/views/admin/partial/nav.blade.php b/resources/views/admin/partial/nav.blade.php index fe011be1a..cbbf17822 100644 --- a/resources/views/admin/partial/nav.blade.php +++ b/resources/views/admin/partial/nav.blade.php @@ -1,7 +1,8 @@