/** * Редактирует объединение * * @param int $id идентификатор объединения * * @return string|\yii\web\Response * @throws \cs\web\Exception */ public function actionObjects_edit($id) { $model = \app\models\Form\Union::find($id); if (is_null($model)) { throw new Exception('Не найдено объединение'); } if ($model->load(Yii::$app->request->post()) && $model->update()) { Yii::$app->session->setFlash('contactFormSubmitted'); return $this->refresh(); } else { return $this->render(['model' => $model]); } }
public function actionObjects_add() { $model = new \app\models\Form\Union(); if ($model->load(Yii::$app->request->post()) && $model->insert()) { Yii::$app->session->setFlash('contactFormSubmitted'); return $this->refresh(); } else { return $this->render(['model' => $model]); } }