validate([ 'current_password' => 'required', 'new_password' => 'required|min:6|confirmed', ]); $user = Auth::user(); if (Hash::check($request->current_password, $user->password)) { $user->password = Hash::make($request->new_password); $user->save(); return back()->with('success', 'Password changed successfully!'); } else { return back()->with('error', 'Current password is incorrect'); } // return view('pengguna.index',compact('api_url','auth_user')); } } ?>