Example #1
0
 /**
  * Insert data
  *
  * @param type $data
  * @return  int
  */
 public function insert($data = NULL)
 {
     if ($id = parent::insert($data)) {
         $this->branching();
         parent::update(array($this->thread_field => $this->{$this->thread_field}, $this->level_field => $this->{$this->level_field}));
     }
     return $id;
 }
Example #2
0
 /**
  * Update post
  *
  * @param type $data
  */
 public function update($data = NULL)
 {
     $data or $data = $this->object()->toArray();
     isset($data['body']) && ($data['last_update'] = time());
     if ($result = parent::update($data)) {
         event('post.update', $this, $data, $result);
     }
     return $result;
 }