public function actionPreview($id, $category_id) { $model = $this->findModel($id); $category = CmsFaqCategories::findOne(['id' => $category_id]); $this->layout = 'preview'; return $this->render('@frontend/views/faq/view', ['model' => $model, 'category' => $category]); }
/** * Updates an existing CmsFaq model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id, $category_id) { $model = $this->findModel($id); $categoryModel = CmsFaqCategories::findOne($category_id); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->getSession()->setFlash('success', 'Successfully updated.'); return $this->redirect(['cms-faq/update', 'id' => $model->id, 'category_id' => $category_id]); } $languages = Lang::find()->all(); $languageDefault = Lang::findOne(['default' => 1]); return $this->render('update', ['model' => $model, 'languages' => $languages, 'languageDefault' => $languageDefault, 'categoryModel' => $categoryModel]); }