public function delete() { if (false === $this->trigger('before_delete', $this)) { return false; } $result = $this->db()->delete($this->data); $this->trigger('after_delete', $this); return $result; }
public function delete($id) { $model = new Model('Comment'); $data = $model->find($id); if (empty($data)) { $this->error('评论不存在'); } if (!$model->delete($id)) { $this->error('删除失败'); } else { $this->success('删除成功'); } }