コード例 #1
0
 /**
  * Creates a new Translation model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  * @throws \yii\base\ErrorException
  */
 public function actionCreate()
 {
     $model = new SourceMessage();
     if (!$model->save()) {
         throw new ErrorException(Yii::t('app', 'Model {modelName} saving failed', ['modelName' => 'SourceMessage']));
     }
     return $this->redirect(['update', 'id' => $model->id]);
 }
 /**
  * Creates a new SourceMessage model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new SourceMessage();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }