public function actionDelete($id) { $model = Page::findOne($id); if ($model) { $model->delete(); } return $this->redirect(['index']); }
public function actionView($uid) { /** @var Page $pageModel */ $pageModel = Page::findOne(['uid' => $uid]); if (!$pageModel) { throw new NotFoundHttpException(Yii::t('app', 'Страница не найдена')); } Yii::$app->megaMenu->getActiveItem()->label = $pageModel->title; return $this->render('view', ['pageModel' => $pageModel]); }