Ejemplo n.º 1
0
 public function actionDelete($id)
 {
     if ($model = Page::findOne($id)) {
         $model->delete();
     } else {
         $this->error = Yii::t('easyii', 'Not found');
     }
     return $this->formatResponse(Yii::t('easyii/page', 'Page deleted'));
 }
Ejemplo n.º 2
0
 private function findPage($id_slug)
 {
     $page = PageModel::find()->where(['or', 'page_id=:id_slug', 'slug=:id_slug'], [':id_slug' => $id_slug])->one();
     return $page ? new PageObject($page) : $this->notFound($id_slug);
 }