tien_nemo

update data tpl

......@@ -135,52 +135,4 @@ class OcrController extends Controller
], 500);
}
}
/**
* Lấy danh sách template
*/
public function getTemplateList()
{
try {
$templates = MstTemplate::select('id', 'tpl_name', 'tpl_text', 'in_date')
->orderBy('created_at', 'desc')
->get();
return response()->json([
'success' => true,
'templates' => $templates
]);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'error' => 'Lỗi khi lấy danh sách template: ' . $e->getMessage()
], 500);
}
}
/**
* Xóa template
*/
public function deleteTemplate($id)
{
try {
$template = MstTemplate::findOrFail($id);
// Xóa các field detail trước
DtTemplate::where('tpl_id', $id)->delete();
// Xóa template chính
$template->delete();
return response()->json([
'success' => true,
'message' => 'Xóa template thành công'
]);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'error' => 'Lỗi khi xóa template: ' . $e->getMessage()
], 500);
}
}
}
......