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 App\Providers\RouteServiceProvider;
5 use Illuminate\Support\Facades\Auth;
6 use Illuminate\Support\Facades\Session;
7 use Livewire\Attributes\Layout;
8 use Livewire\Volt\Component;
9
10 new #[Layout('layouts.guest')] class extends Component
11 {
12     /**
13      * Send an email verification notification to the user.
14      */
15     public function sendVerification(): void
16     {
17         if (Auth::user()->hasVerifiedEmail()) {
18             $this->redirectIntended(default: RouteServiceProvider::HOME, navigate: true);
19
20             return;
21         }
22
23         Auth::user()->sendEmailVerificationNotification();
24
25         Session::flash('status', 'verification-link-sent');
26     }
27
28     /**
29      * Log the current user out of the application.
30      */
31     public function logout(Logout $logout): void
32     {
33         $logout();
34
35         $this->redirect('/', navigate: true);
36     }
37 }; ?>
38
39 <div>
40     <div class="mb-4 text-sm text-gray-600">
41         {{ __('Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn\'t receive the email, we will gladly send you another.') }}
42     </div>
43
44     @if (session('status') == 'verification-link-sent')
45         <div class="mb-4 font-medium text-sm text-green-600">
46             {{ __('A new verification link has been sent to the email address you provided during registration.') }}
47         </div>
48     @endif
49
50     <div class="mt-4 flex items-center justify-between">
51         <x-primary-button wire:click="sendVerification">
52             {{ __('Resend Verification Email') }}
53         </x-primary-button>
54
55         <button wire:click="logout" type="submit" class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
56             {{ __('Log Out') }}
57         </button>
58     </div>
59 </div>