' . $fileContent); // สร้าง array จากข้อมูลในไฟล์ $data = [ 'database' => $DATABASE, 'primary_key' => $PKEY, 'format' => $FORMAT, ]; // แปลง array เป็น JSON $jsonContent = json_encode($data, JSON_PRETTY_PRINT); // เขียน JSON ลงในไฟล์ใหม่ในโฟลเดอร์ json $jsonFileName = pathinfo($file, PATHINFO_FILENAME) . '.json'; file_put_contents($jsonPath . '/' . $jsonFileName, $jsonContent); } } return response()->json(['message' => 'Conversion complete!']); } }