diff --git a/app/Helpers/UserHelper.php b/app/Helpers/UserHelper.php new file mode 100644 index 0000000..28e0b96 --- /dev/null +++ b/app/Helpers/UserHelper.php @@ -0,0 +1,9 @@ + + + user()->authorizeRoles(['Admin', 'Insider', 'User']); + $request->user()->authorizeRoles(['Admin', 'Editor', 'Platinum Insider', 'Gold Insider', 'Silver Insider', 'Bronze Insider', 'User']); return view('profile'); } @@ -45,7 +45,7 @@ public function show($id) { * @return \Illuminate\Http\Response */ public function edit(Request $request, $id) { - $request->user()->authorizeRoles(['Admin', 'Insider', 'User']); + $request->user()->authorizeRoles(['Admin', 'Editor', 'Platinum Insider', 'Gold Insider', 'Silver Insider', 'Bronze Insider', 'User']); $user = User::find($id); diff --git a/app/Providers/HelperServiceProvider.php b/app/Providers/HelperServiceProvider.php index 61bd38f..7634b7a 100644 --- a/app/Providers/HelperServiceProvider.php +++ b/app/Providers/HelperServiceProvider.php @@ -27,5 +27,6 @@ public function register() require_once app_path('Helpers/RingHelper.php'); require_once app_path('Helpers/TileHelper.php'); require_once app_path('Helpers/BuildFeedHelper.php'); + require_once app_path('Helpers/UserHelper.php'); } } diff --git a/app/User.php b/app/User.php index 4ca33d9..2514956 100644 --- a/app/User.php +++ b/app/User.php @@ -36,4 +36,16 @@ public function hasRole($role) { public function getRoles() { return $this->roles()->firstOrFail(); } + + public function getBadge() { + switch ($this->getRoles()['name']) { + case 'Admin': return ['fa-user-crown', 'admin']; break; + case 'Editor': return ['fa-user-edit', 'editor']; break; + case 'Platinum Insider': return ['fa-crown', 'platinum']; break; + case 'Gold Insider': return ['fa-crown', 'gold']; break; + case 'Silver Insider': return ['fa-crown', 'silver']; break; + case 'Bronze Insider': return ['fa-crown', 'bronze']; break; + default: return null; break; + } + } } diff --git a/public/css/app.css b/public/css/app.css index 68d28d6..0f4ec49 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -10197,6 +10197,28 @@ h3 { background-color: #fad6cc; } +.badge { + width: 2.5rem; + line-height: 1rem; + border-radius: 100px; + color: #fff; +} +.badge.badge-admin { + background-color: #ff4355 !important; +} +.badge.badge-platinum { + background-color: #bdcfd4 !important; +} +.badge.badge-gold { + background-color: #ffc000 !important; +} +.badge.badge-silver { + background-color: #9eacbd !important; +} +.badge.badge-bronze { + background-color: #cd7f32 !important; +} + .dropdown-menu { border: none; border-radius: 3px; diff --git a/resources/sass/_badge.scss b/resources/sass/_badge.scss new file mode 100644 index 0000000..79d5516 --- /dev/null +++ b/resources/sass/_badge.scss @@ -0,0 +1,26 @@ +.badge { + width: 2.5rem; + line-height: 1rem; + border-radius: 100px; + color: #fff; + + &.badge-admin { + background-color: $accent !important; + } + + &.badge-platinum { + background-color: #bdcfd4 !important; + } + + &.badge-gold { + background-color: $yellow !important; + } + + &.badge-silver { + background-color: #9eacbd !important; + } + + &.badge-bronze { + background-color: #cd7f32 !important; + } +} \ No newline at end of file diff --git a/resources/sass/app.scss b/resources/sass/app.scss index 3869015..4cb4f1d 100644 --- a/resources/sass/app.scss +++ b/resources/sass/app.scss @@ -19,6 +19,7 @@ @import 'jumbotron'; @import 'modal'; @import 'progress'; +@import 'badge'; @import 'dropdown'; // ChangeWindows diff --git a/resources/views/profile.blade.php b/resources/views/profile.blade.php index 26af60f..e629c55 100644 --- a/resources/views/profile.blade.php +++ b/resources/views/profile.blade.php @@ -4,7 +4,7 @@ @section('hero')