Showing
1 changed file
with
0 additions
and
48 deletions
| ... | @@ -135,52 +135,4 @@ class OcrController extends Controller | ... | @@ -135,52 +135,4 @@ class OcrController extends Controller |
| 135 | ], 500); | 135 | ], 500); |
| 136 | } | 136 | } |
| 137 | } | 137 | } |
| 138 | - | ||
| 139 | - /** | ||
| 140 | - * Lấy danh sách template | ||
| 141 | - */ | ||
| 142 | - public function getTemplateList() | ||
| 143 | - { | ||
| 144 | - try { | ||
| 145 | - $templates = MstTemplate::select('id', 'tpl_name', 'tpl_text', 'in_date') | ||
| 146 | - ->orderBy('created_at', 'desc') | ||
| 147 | - ->get(); | ||
| 148 | - | ||
| 149 | - return response()->json([ | ||
| 150 | - 'success' => true, | ||
| 151 | - 'templates' => $templates | ||
| 152 | - ]); | ||
| 153 | - } catch (\Exception $e) { | ||
| 154 | - return response()->json([ | ||
| 155 | - 'success' => false, | ||
| 156 | - 'error' => 'Lỗi khi lấy danh sách template: ' . $e->getMessage() | ||
| 157 | - ], 500); | ||
| 158 | - } | ||
| 159 | - } | ||
| 160 | - | ||
| 161 | - /** | ||
| 162 | - * Xóa template | ||
| 163 | - */ | ||
| 164 | - public function deleteTemplate($id) | ||
| 165 | - { | ||
| 166 | - try { | ||
| 167 | - $template = MstTemplate::findOrFail($id); | ||
| 168 | - | ||
| 169 | - // Xóa các field detail trước | ||
| 170 | - DtTemplate::where('tpl_id', $id)->delete(); | ||
| 171 | - | ||
| 172 | - // Xóa template chính | ||
| 173 | - $template->delete(); | ||
| 174 | - | ||
| 175 | - return response()->json([ | ||
| 176 | - 'success' => true, | ||
| 177 | - 'message' => 'Xóa template thành công' | ||
| 178 | - ]); | ||
| 179 | - } catch (\Exception $e) { | ||
| 180 | - return response()->json([ | ||
| 181 | - 'success' => false, | ||
| 182 | - 'error' => 'Lỗi khi xóa template: ' . $e->getMessage() | ||
| 183 | - ], 500); | ||
| 184 | - } | ||
| 185 | - } | ||
| 186 | } | 138 | } | ... | ... |
-
Please register or sign in to post a comment