function delete() { $id = $this->uri->segment(4); $catalogue = new Landcategory($id); //delete catalogue $catalogue->delete(); flash_message('success', 'Xóa thành công'); //redirect to catalogue redirect($this->admin . 'landcategories/list_all'); }
function save($object = '', $related_field = '') { if (!$this->exists()) { $o = new Landcategory(); $o->select_max('position'); $o->get(); if (count($o->all) != 0) { $max = $o->position + 1; $this->position = $max; } else { $this->postion = 1; } } return parent::save($object, $related_field); }