Ejemplo n.º 1
0
 function save($object = '', $related_field = '')
 {
     if (!$this->exists()) {
         $o = new Province();
         $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);
 }