validate([ 'current_password' => 'required', 'new_password' => 'required|min:8', 'confirm_password' => 'required|same:new_password', ]); $user = auth()->user(); // Cek apakah password lama sesuai if (!Hash::check($request->current_password, $user->password)) { return back()->withErrors(['current_password' => 'Password lama salah!']); } // Update password $user->update(['password' => Hash::make($request->new_password)]); return redirect()->route('dashboard')->with('success', 'Password berhasil diubah!'); } catch (\Exception $e) { return redirect()->route('setting.index')->with('error', 'Password gagal diubah ' . $e->getMessage()); } } /** * Remove the specified resource from storage. */ public function destroy(string $id) { // } }