Example #1
0
 /**
  * Creates a new Block model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($source_id = -1, $lang_id = -1)
 {
     if ($lang_id == -1) {
         $lang_id = Language::getDefaultID();
     }
     $model = new Block();
     $model->source_id = $source_id;
     $model->lang_id = $lang_id;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }