progetto di test della creazione di un progetto basato sul framework laravel e aggiunta form login e register utilizzando breeze
filippo.bertilotti
2024-04-12 f7d0ce435d960868043e25ce3a7c647c890bb132
commit | author | age
f7d0ce 1 <?php
F 2
3 use App\Livewire\Actions\Logout;
4 use Livewire\Volt\Component;
5
6 new class extends Component
7 {
8     /**
9      * Log the current user out of the application.
10      */
11     public function logout(Logout $logout): void
12     {
13         $logout();
14
15         $this->redirect('/', navigate: true);
16     }
17 }; ?>
18
19 <nav x-data="{ open: false }" class="bg-white border-b border-gray-100">
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" />
28                     </a>
29                 </div>
30
31                 <!-- Navigation Links -->
32                 <div class="hidden space-x-8 sm:-my-px sm:ms-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:ms-6">
41                 <x-dropdown align="right" width="48">
42                     <x-slot name="trigger">
43                         <button class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none transition ease-in-out duration-150">
44                             <div x-data="{{ json_encode(['name' => auth()->user()->name]) }}" x-text="name" x-on:profile-updated.window="name = $event.detail.name"></div>
45
46                             <div class="ms-1">
47                                 <svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
48                                     <path fill-rule="evenodd" 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" clip-rule="evenodd" />
49                                 </svg>
50                             </div>
51                         </button>
52                     </x-slot>
53
54                     <x-slot name="content">
55                         <x-dropdown-link :href="route('profile')" wire:navigate>
56                             {{ __('Profile') }}
57                         </x-dropdown-link>
58
59                         <!-- Authentication -->
60                         <button wire:click="logout" class="w-full text-start">
61                             <x-dropdown-link>
62                                 {{ __('Log Out') }}
63                             </x-dropdown-link>
64                         </button>
65                     </x-slot>
66                 </x-dropdown>
67             </div>
68
69             <!-- Hamburger -->
70             <div class="-me-2 flex items-center sm:hidden">
71                 <button @click="open = ! open" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out">
72                     <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
73                         <path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
74                         <path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
75                     </svg>
76                 </button>
77             </div>
78         </div>
79     </div>
80
81     <!-- Responsive Navigation Menu -->
82     <div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
83         <div class="pt-2 pb-3 space-y-1">
84             <x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate>
85                 {{ __('Dashboard') }}
86             </x-responsive-nav-link>
87         </div>
88
89         <!-- Responsive Settings Options -->
90         <div class="pt-4 pb-1 border-t border-gray-200">
91             <div class="px-4">
92                 <div class="font-medium text-base text-gray-800" x-data="{{ json_encode(['name' => auth()->user()->name]) }}" x-text="name" x-on:profile-updated.window="name = $event.detail.name"></div>
93                 <div class="font-medium text-sm text-gray-500">{{ auth()->user()->email }}</div>
94             </div>
95
96             <div class="mt-3 space-y-1">
97                 <x-responsive-nav-link :href="route('profile')" wire:navigate>
98                     {{ __('Profile') }}
99                 </x-responsive-nav-link>
100
101                 <!-- Authentication -->
102                 <button wire:click="logout" class="w-full text-start">
103                     <x-responsive-nav-link>
104                         {{ __('Log Out') }}
105                     </x-responsive-nav-link>
106                 </button>
107             </div>
108         </div>
109     </div>
110 </nav>