/** * Creates a new User model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new User(['scenario' => 'signup']); $model1 = new AmgenContactListvalidate(); if ($model->load(Yii::$app->request->post()) && $model1->load(Yii::$app->request->post()) && $model->validate() && $model1->validate()) { $fname = $_POST['AmgenContactListvalidate']['first_name']; $lname = $_POST['AmgenContactListvalidate']['last_name']; $model1->first_name = $fname; $model1->last_name = $lname; $model1->Title = $_POST['AmgenContactListvalidate']['Title']; $model1->function_Id = $_POST['AmgenContactListvalidate']['function_Id']; $model1->group_Id = $_POST['AmgenContactListvalidate']['group_Id']; $model1->Phone = $_POST['AmgenContactListvalidate']['Phone']; $model1->speciality = $_POST['AmgenContactListvalidate']['speciality']; $fullname = $fname . " " . $lname; $model1->Name = $fullname; if ($model1->save()) { $id = $model1->id; $password = $_POST['User']['password_hash']; $hash = Yii::$app->getSecurity()->generatePasswordHash($password); $model->password_hash = $hash; //generating password hash $model->attendee_id = $id; $model->first_name = $fname; $model->last_name = $lname; $model->save(); Yii::$app->session->setFlash('success', 'User Sucessfully Created'); return $this->redirect(['view', 'id' => $model->id]); } } else { return $this->render('create', ['model' => $model, 'model1' => $model1]); } }
/** * Creates a new AmgenContactListvalidate model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new AmgenContactListvalidate(); if ($model->load(Yii::$app->request->post())) { $fname = $model->first_name; $lname = $model->last_name; $fullname = $fname . " " . $lname; $model->Name = $fullname; $model->save(); return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }