response->setJSON( // [ // 'message' => "Label Dicetak", // 'status' => true, // ] // ); // } else { // $output = json_encode($output); // Konversi ke JSON // return $this->response->setJSON( // [ // 'error' => $output, // 'message' => "Label Gagal Dicetak", // 'status' => false, // ] // ); // } // } public function sample($access, $sample) { // Path shared printer menggunakan format yang lebih jelas $path = '\\\\10.148.5.20\\Labelshare\\'; $filename = "file_ku.txt"; $sampleLable ="N N OD q400 Q224,24+0 I8,A,001 D10 A10,3,0,3,1,1,N,'MRS. MIKAELA LETTA XABRIANA' A10,25,0,1,1,1,N,'M 22Y' A10,65,0,1,1,1,N,'SERUMAH' A288,65,0,1,1,1,N,'2402084063' B90,30,0,1,2,8,70,N,'2402084063' A10,110,0,2,1,1,N,'PSA,HDL,LDL,BUN,SGOT' A10,131,0,1,1,1,N,'LIS : 0978658' A10,145,0,1,1,1,N,'HIS : 1252434' A250,140,0,3,1,1,N,'2402084063' P1 "; $fullPath = $path . $filename; // Tulis file ke folder tujuan if (file_put_contents($fullPath, $content)) { // echo "File berhasil dibuat di folder $folderPath"; return $this->response->setJSON( [ 'message' => "File Berhasil di kirim", 'status' => true, ] ); } else { return $this->response->setJSON( [ 'error' => $output, 'message' => "Gagal", 'status' => false, ] ); } } }