name = Auth::user()->name; $this->email = Auth::user()->email; } public function updateProfile(): void { $data = $this->validate([ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'email', 'max:255', Rule::unique('users', 'email')->ignore(Auth::id())], ]); Auth::user()->update($data); $this->audit('profile.update', $data['email']); $this->dispatch('notify', message: __('settings.profile_saved')); } public function updatePassword(): void { $this->validate([ 'current_password' => ['required', 'current_password'], 'password' => ['required', 'confirmed', Password::min(10)], ]); Auth::user()->update(['password' => $this->password, 'must_change_password' => false]); $this->reset('current_password', 'password', 'password_confirmation'); $this->audit('password.change', Auth::user()->email); $this->dispatch('notify', message: __('settings.password_changed')); } private function audit(string $action, string $target): void { AuditEvent::create([ 'user_id' => Auth::id(), 'actor' => Auth::user()->name, 'action' => $action, 'target' => $target, 'ip' => request()->ip(), ]); } public function render() { return view('livewire.settings.profile'); } }