$input */ public function update(User $user, array $input): void { Validator::make($input, [ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)], 'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'], ])->validateWithBag('updateProfileInformation'); if (isset($input['photo'])) { $user->updateProfilePhoto($input['photo']); } 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(); $user->sendEmailVerificationNotification(); } }