From 0071c2218b9ea1df89faa77ab7994d7660c1766f Mon Sep 17 00:00:00 2001 From: 1Day Date: Wed, 8 Jun 2022 11:01:28 +0200 Subject: [PATCH] click to copy Ref URL // Badge Color on Profile --- app/Http/Controllers/ProfileController.php | 15 ++++++++++ resources/views/profile/index.blade.php | 35 +++++++++++++++++++--- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 57709b62..dce3e96a 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -16,11 +16,26 @@ class ProfileController extends Controller /** Display a listing of the resource. */ public function index() { + switch (Auth::user()->role) { + case 'admin': + $badgeColor = 'badge-danger'; + break; + case 'mod': + $badgeColor = 'badge-info'; + break; + case 'client': + $badgeColor = 'badge-success'; + break; + default: + $badgeColor = 'badge-secondary'; + break; + } return view('profile.index')->with([ 'user' => Auth::user(), 'credits_reward_after_verify_discord' => config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD'), 'force_email_verification' => config('SETTINGS::USER:FORCE_EMAIL_VERIFICATION'), 'force_discord_verification' => config('SETTINGS::USER:FORCE_DISCORD_VERIFICATION'), + 'badgeColor' => $badgeColor, ]); } diff --git a/resources/views/profile/index.blade.php b/resources/views/profile/index.blade.php index bf31a1c9..0c454bde 100644 --- a/resources/views/profile/index.blade.php +++ b/resources/views/profile/index.blade.php @@ -105,7 +105,10 @@
- {{_("Referral URL")}} : {{route("register")}}?ref={{$user->referral_code}} + {{_("Referral URL")}} : + + {{route("register")}}?ref={{$user->referral_code}} + @else @@ -115,9 +118,8 @@ @endif
-
{{ $user->role }} + class="badge {{$badgeColor}}">{{ $user->role }}
{{ $user->created_at->isoFormat('LL') }}
@@ -304,5 +306,30 @@
- + @endsection +