function save($object = '', $related_field = '') { if (!$this->exists()) { $o = new Jobscat(); $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); }
/** * Jobscats::delete() * @param integer $id * @return */ function delete($id) { $jobscat = new Jobscat($id); if ($jobscat->delete()) { flash_message('success', 'Danh mục công việc đã được xóa thành công'); redirect($this->admin_url . 'jobscats/listAll'); } }