singleloginsystem/resources/views/components/dashbord-topbar.blade.php
= ec26c0a205 Refactor: user in dashboard topbar and fix binding
- Centralized user data retrieval in `dashboard-topbar.blade.php` by introducing `$user` variable.
- Enhanced topbar dropdown with user details (name, email) and improved styling.
- Fixed Livewire binding in roles-and-apps view by replacing `model` with `wire:model`.
2026-05-21 13:20:27 +00:00

41 lines
1.4 KiB
PHP

@php use App\Enums\DefaultUserRole;
$user = auth()->user();
@endphp
<div class="w-full py-4 px-10 border-b border-gray-200 flex justify-center">
<div class="flex-1 py-2">
@if($user?->hasRole(DefaultUserRole::Admin->value))
<p class="text-xl font-medium">Admin Panel</p>
@endif
</div>
<div class="flex space-x-4 items-center">
<x-shared.button>
<x-lucide-bell class="w-5 h-5"/>
</x-shared.button>
<x-mary-dropdown>
<x-slot:trigger>
<div
class="rounded-full w-12 h-12 bg-blue-200 flex items-center justify-center font-semibold text-blue-800 cursor-pointer">
{{ $user->initials() }}
</div>
</x-slot:trigger>
<x-mary-menu-item>
<div class="">
<p class="font-semibold font-lg ">{{$user->name}}</p>
<p class="text-sm text-base-content/50 ">{{$user->email}}</p>
</div>
</x-mary-menu-item>
<div class="h-[0.5px] bg-gray-100"></div>
<form method="POST" action="{{ route('logout') }}">
@csrf
<x-mary-menu-item
title="Log out"
icon="lucide.log-out"
onclick="event.preventDefault(); this.closest('form').submit();"
/>
</form>
</x-mary-dropdown>
</div>
</div>