示例#1
0
 /**
  * Finds the LetCategory model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return LetCategory the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = LetCategory::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#2
0
 /**
  * Delete a category
  */
 public function actionDelete()
 {
     try {
         $id = (int) ArrayHelper::getValue($_POST, 'id', 0);
         $model = LetCategory::findOne($id);
         if ($model->deleteNode()) {
             echo 1;
         } else {
             echo 0;
         }
     } catch (ErrorException $e) {
         echo 0;
     }
 }