|
@@ -17,6 +17,7 @@ class CommentsController extends BaseController
|
|
/**
|
|
/**
|
|
* @inheritDoc
|
|
* @inheritDoc
|
|
*/
|
|
*/
|
|
|
|
+
|
|
public function behaviors()
|
|
public function behaviors()
|
|
{
|
|
{
|
|
return array_merge(
|
|
return array_merge(
|
|
@@ -103,12 +104,15 @@ class CommentsController extends BaseController
|
|
public function actionUpdate($id)
|
|
public function actionUpdate($id)
|
|
{
|
|
{
|
|
$model = $this->findModel($id);
|
|
$model = $this->findModel($id);
|
|
|
|
+ if (isset($_POST['Comments'])) {
|
|
|
|
+ $model->message = $_POST['Comments']['message'];
|
|
|
|
+ $model->visible = $_POST['Comments']['visible'];
|
|
|
|
+ if ($model->save()) {
|
|
|
|
+ return $this->redirect(['view', 'id' => $model->id]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) {
|
|
|
|
- return $this->redirect(['view', 'id' => $model->id]);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return $this->render('update', [
|
|
|
|
|
|
+ return $this->render('update', [
|
|
'model' => $model,
|
|
'model' => $model,
|
|
]);
|
|
]);
|
|
}
|
|
}
|