name = Auth::user()->name; $this->email = Auth::user()->email; $this->preferred_username = Auth::user()->preferred_username; $this->avatar = Auth::user()->avatar; } /** * Update the profile information for the currently authenticated user. */ public function updateProfileInformation(): void { $user = Auth::user(); $validated = $this->validate([ 'name' => 'required|string|max:255', 'email' => [ 'required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($user->id), ], 'preferred_username' => 'string|max:255' ]); $user->fill($validated); if (!empty($this->avatarUpload)) { if (!empty($user->avatar)) { Storage::disk('avatars')->delete($user->avatar); } $user->avatar = $this->avatarUpload->store(options: 'avatars'); } $user->save(); $this->dispatch('profile-updated', name: $user->name); } /** * Send an email verification notification to the current user. */ public function resendVerificationNotification(): void { $user = Auth::user(); if ($user->hasVerifiedEmail()) { $this->redirectIntended(default: route('dashboard', absolute: false)); return; } $user->sendEmailVerificationNotification(); Session::flash('status', 'verification-link-sent'); } public function render() { return view('livewire.forms.user-profile'); } }