public function actionDelete() { $model = new Category(); $params = $this->request->getParams(); $id = $params['id']; if (empty($id)) { throw new TQExceptionHandle("Record not found.", 404); } if (!$model->findByPk($id)) { throw new TQExceptionHandle("Record not found.", 404); } if ($model->delete()) { $this->setFlashMessage('warning', 'Delete success!'); $this->redirect('category/index'); } }