/** * Creates a new CsRegulations model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new CsRegulations(); $model_trans = new CsRegulationsTranslation(); if ($model->load(Yii::$app->request->post()) and $model_trans->load(Yii::$app->request->post())) { if ($model->save()) { $model_trans->regulation_id = $model->id; $model_trans->orig_name = $model->name; $model_trans->save(); return $this->redirect(['view', 'id' => $model->id]); } } else { return $this->render('create', ['model' => $model, 'model_trans' => $model_trans]); } }