detailz = $user->detailz; $this->detailzForm->setDetailz($user->detailz); } public function updatePassword() { $validatedData = Validator::make( ['currentPassword' => $this->currentPassword, 'newPassword' => $this->newPassword, 'newPasswordConfirm' => $this->newPasswordConfirm], ['currentPassword' => 'required|string|min:6', 'newPassword' => 'required|string|min:6', 'newPasswordConfirm' => 'required|string|min:6'], ['required' => 'The :attribute field is required'] )->after(function ($validator) { if (! isset($this->currentPassword) || ! Hash::check($this->currentPassword, $this->user->password)) { $validator->errors()->add('currentPassword', __('The provided password does not match your current password.')); } if ($this->newPassword !== $this->newPasswordConfirm) { $validator->errors()->add('newPasswordConfirm', __('The password and confirm password fields do not match.')); } })->validate(); /* dd($validatedData); */ $this->user->forceFill([ 'password' => Hash::make($validatedData['newPassword']), ])->save(); $this->validatedData = $validatedData; $this->reset(['currentPassword', 'newPassword', 'newPasswordConfirm']); /* dd($this->currentPassword, $this->newPassword, $this->newPasswordConfirm, $validatedData); */ } public function refineDetailz() { $this->detailzForm->update(); } public function render() { return view('livewire.profile.edit-detailz-form'); } }