/** * Updates an existing CmsRecipes 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); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->getSession()->setFlash('success', 'Successfully updated.'); return $this->redirect(['cms-recipes/update', 'id' => $model->id, 'category_id' => $category_id]); } $languages = Lang::find()->all(); $languageDefault = Lang::findOne(['default' => 1]); $categoryModel = CmsRecipesCategories::findOne($category_id); return $this->render('update', ['model' => $model, 'languages' => $languages, 'languageDefault' => $languageDefault, 'categoryModel' => $categoryModel]); }
/** * Displays a single CmsRecipes model. * @param integer $id * @return mixed */ public function actionView($category_id, $id) { $model = $this->findModel($id); $category = CmsRecipesCategories::findOne(['id' => $category_id]); return $this->render('view', ['model' => $model, 'category' => $category]); }