diff --git a/stubs/UpdateUserProfileInformation.php b/stubs/UpdateUserProfileInformation.php index 0930ddf3..05e21cfb 100644 --- a/stubs/UpdateUserProfileInformation.php +++ b/stubs/UpdateUserProfileInformation.php @@ -29,30 +29,19 @@ public function update(User $user, array $input): void ], ])->validateWithBag('updateProfileInformation'); - if ($input['email'] !== $user->email && - $user instanceof MustVerifyEmail) { - $this->updateVerifiedUser($user, $input); - } else { - $user->forceFill([ - 'name' => $input['name'], - 'email' => $input['email'], - ])->save(); - } - } - - /** - * Update the given verified user's profile information. - * - * @param array $input - */ - protected function updateVerifiedUser(User $user, array $input): void - { $user->forceFill([ 'name' => $input['name'], 'email' => $input['email'], - 'email_verified_at' => null, - ])->save(); + ]); + + if ($user->isDirty('email') && $user instanceof MustVerifyEmail) { + $user->email_verified_at = null; + } + + $user->save(); - $user->sendEmailVerificationNotification(); + if ($user->wasChanged('email') && $user instanceof MustVerifyEmail) { + $user->sendEmailVerificationNotification(); + } } }