Add user role in menu for admin users

This commit is contained in:
brufdev
2025-09-10 17:08:31 +01:00
parent eb5c8288fd
commit c02c3e0f2d
2 changed files with 18 additions and 1 deletions
+11
View File
@@ -28,6 +28,17 @@ final class User extends Authenticatable
'remember_token',
];
/**
* Indicate if the user is a super admin.
*/
public function isSuperAdmin(): bool
{
/** @var UserRole $role */
$role = $this->role;
return $role === UserRole::SUPER_ADMIN;
}
/**
* Indicate if the user is an admin.
*/
@@ -9,10 +9,16 @@
</x-menu.button>
<x-menu.items>
<div class="px-3">
<div class="px-3 font-semibold">
{{ auth()->user()->name }}
</div>
@if (auth()->user()->isSuperAdmin())
<div class="text-xs px-3 text-light-base-700 dark:text-base-400">{{ __('Super Admin') }}</div>
@elseif (auth()->user()->isAdmin())
<div class="text-xs px-3 text-light-base-700 dark:text-base-400">{{ __('Admin') }}</div>
@endif
<x-menu.itemDivider></x-menu.itemDivider>
<x-modal>