@@ 81-93 (lines=13) @@ | ||
78 | * If creation is successful, the browser will be redirected to the 'view' page. |
|
79 | * @return mixed |
|
80 | */ |
|
81 | public function actionCreate() |
|
82 | { |
|
83 | $model = new CmsModel(); |
|
84 | ||
85 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|
86 | Yii::$app->session->setFlash('success', Yii::t('yii2mod.cms', 'Page has been created.')); |
|
87 | return $this->redirect(['index']); |
|
88 | } |
|
89 | ||
90 | return $this->render($this->viewPath . 'create', [ |
|
91 | 'model' => $model, |
|
92 | ]); |
|
93 | } |
|
94 | ||
95 | /** |
|
96 | * Updates an existing CmsModel model. |
|
@@ 103-114 (lines=12) @@ | ||
100 | * |
|
101 | * @return mixed |
|
102 | */ |
|
103 | public function actionUpdate($id) |
|
104 | { |
|
105 | $model = $this->findModel($id); |
|
106 | ||
107 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|
108 | Yii::$app->session->setFlash('success', Yii::t('yii2mod.cms', 'Page has been updated.')); |
|
109 | return $this->redirect(['index']); |
|
110 | } |
|
111 | return $this->render($this->viewPath . 'update', [ |
|
112 | 'model' => $model, |
|
113 | ]); |
|
114 | } |
|
115 | ||
116 | /** |
|
117 | * Deletes an existing CmsModel model. |