navigation.blade.php (5759B)
1 <?php 2 3 use Livewire\Volt\Component; 4 5 new class extends Component { 6 public function logout(): void 7 { 8 auth() 9 ->guard('web') 10 ->logout(); 11 12 session()->invalidate(); 13 session()->regenerateToken(); 14 15 $this->redirect('/', navigate: true); 16 } 17 }; ?> 18 19 <nav x-data="{ open: false }" class="bg-white dark:bg-gray-800 border-b border-gray-100 dark:border-gray-700"> 20 <!-- Primary Navigation Menu --> 21 <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> 22 <div class="flex justify-between h-16"> 23 <div class="flex"> 24 <!-- Logo --> 25 <div class="shrink-0 flex items-center"> 26 <a href="{{ route('dashboard') }}" wire:navigate> 27 <x-application-logo class="block h-9 w-auto fill-current text-gray-800 dark:text-gray-200" /> 28 </a> 29 </div> 30 31 <!-- Navigation Links --> 32 <div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex"> 33 <x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate> 34 {{ __('Dashboard') }} 35 </x-nav-link> 36 </div> 37 </div> 38 39 <!-- Settings Dropdown --> 40 <div class="hidden sm:flex sm:items-center sm:ml-6"> 41 <x-dropdown align="right" width="48"> 42 <x-slot name="trigger"> 43 <button 44 class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 hover:text-gray-700 dark:hover:text-gray-300 focus:outline-none transition ease-in-out duration-150"> 45 <div x-data="{ name: '{{ auth()->user()->name }}' }" x-text="name" 46 x-on:profile-updated.window="name = $event.detail.name"></div> 47 48 <div class="ml-1"> 49 <svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" 50 viewBox="0 0 20 20"> 51 <path fill-rule="evenodd" 52 d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" 53 clip-rule="evenodd" /> 54 </svg> 55 </div> 56 </button> 57 </x-slot> 58 59 <x-slot name="content"> 60 <x-dropdown-link :href="route('profile')" wire:navigate> 61 {{ __('Profile') }} 62 </x-dropdown-link> 63 64 <!-- Authentication --> 65 <button wire:click="logout" class="w-full text-left"> 66 <x-dropdown-link> 67 {{ __('Log Out') }} 68 </x-dropdown-link> 69 </button> 70 </x-slot> 71 </x-dropdown> 72 </div> 73 74 <!-- Hamburger --> 75 <div class="-mr-2 flex items-center sm:hidden"> 76 <button @click="open = ! open" 77 class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 dark:text-gray-500 hover:text-gray-500 dark:hover:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-900 focus:outline-none focus:bg-gray-100 dark:focus:bg-gray-900 focus:text-gray-500 dark:focus:text-gray-400 transition duration-150 ease-in-out"> 78 <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24"> 79 <path :class="{ 'hidden': open, 'inline-flex': !open }" class="inline-flex" 80 stroke-linecap="round" stroke-linejoin="round" stroke-width="2" 81 d="M4 6h16M4 12h16M4 18h16" /> 82 <path :class="{ 'hidden': !open, 'inline-flex': open }" class="hidden" stroke-linecap="round" 83 stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /> 84 </svg> 85 </button> 86 </div> 87 </div> 88 </div> 89 90 <!-- Responsive Navigation Menu --> 91 <div :class="{ 'block': open, 'hidden': !open }" class="hidden sm:hidden"> 92 <div class="pt-2 pb-3 space-y-1"> 93 <x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate> 94 {{ __('Dashboard') }} 95 </x-responsive-nav-link> 96 </div> 97 98 <!-- Responsive Settings Options --> 99 <div class="pt-4 pb-1 border-t border-gray-200 dark:border-gray-600"> 100 <div class="px-4"> 101 <div class="font-medium text-base text-gray-800 dark:text-gray-200" x-data="{ name: '{{ auth()->user()->name }}' }" 102 x-text="name" x-on:profile-updated.window="name = $event.detail.name"></div> 103 <div class="font-medium text-sm text-gray-800">{{ auth()->user()->email }}</div> 104 </div> 105 106 <div class="mt-3 space-y-1"> 107 <x-responsive-nav-link :href="route('profile')" wire:navigate> 108 {{ __('Profile') }} 109 </x-responsive-nav-link> 110 111 <!-- Authentication --> 112 <button wire:click="logout" class="w-full text-left"> 113 <x-responsive-nav-link> 114 {{ __('Log Out') }} 115 </x-responsive-nav-link> 116 </button> 117 </div> 118 </div> 119 </div> 120 </nav>