diff --git a/controllers/tourController.js b/controllers/tourController.js
index e098cd7317587c7d5ed779d787fbb0ee665c82f7..488b1e336a4b0de0b574ad48ab012446c192d112 100644
--- a/controllers/tourController.js
+++ b/controllers/tourController.js
@@ -256,16 +256,22 @@ exports.postEditTour = async (req, res) => {
 
 exports.deleteTour = async (req, res) => {
   try {
-    console.log("Tour ID ที่ต้องการลบ:", req.params.id);
-    await Tour.deleteTour(req.params.id);
-    res.redirect('/tours'); // กลับไปที่หน้ารายการทัวร์
+    const tourId = req.params.id;
+    console.log("Request to delete tour ID:", tourId); // ตรวจสอบค่า ID
+
+    if (!tourId) {
+      return res.status(400).send("Tour ID is required");
+    }
+
+    await Tour.deleteTour(tourId);
+    res.redirect('/tourlist'); // หรือส่ง JSON กลับ
   } catch (error) {
-    console.error(error.message);
     res.status(500).send(error.message);
   }
 };
 
 
+
 //ค้นหาทัวร์
 exports.searchTours = async (req, res) => {
   try {