From dac0d083196a1eeeb2e3744fbd46c17257e3cf8e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 5 May 2023 00:00:11 -0600 Subject: [PATCH 1/4] Update admin dashboard, fix search and dropdown menu --- app/Services/AvatarService.php | 23 +++++++++ app/User.php | 10 ++++ resources/views/admin/partial/nav.blade.php | 57 ++++++++++++++++----- 3 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 app/Services/AvatarService.php 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 @@