/** * Creates a new Account model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Account(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Account model. * If creation is successful, the browser will be redirected to the 'index' page. * @return mixed */ public function actionCreate() { $model = new Account(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->session->setFlash("Account-success", Yii::t("app", "Account successfully created")); return $this->redirect(['index']); } else { $currencyItems = Currency::find()->select(['id', 'name'])->where(['user_id' => Yii::$app->user->id])->asArray()->all(); $currencyItems = ArrayHelper::map($currencyItems, 'id', 'name'); return $this->render('create', ['model' => $model, 'currencyItems' => $currencyItems]); } }