function delete() { $this->checkRole(array(1)); $id = $this->uri->segment(4); if ($id != 1 && $id != 19) { $bannercat = new bannercat($id); //delete city if (count($bannercat->child->all) > 0) { flash_message('error', 'không thể xóa menu gốc, vui lòng xóa menu con trước'); } else { $bannercat->delete(); } //redirect to city } else { flash_message('error', 'không thể xóa danh mục này'); } redirect($this->admin . 'bannercats/list_all/'); }