/** * Creates a new Personnel model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Personnel(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionAddUser() { $model = new Personnel(); $request = Yii::$app->request; if ($request->isGet) { $key = $request->get("key"); $model->{$key} = $request->get("v"); $model->DepartmentNumber = $request->get("depart_num"); if ($model->save()) { echo $model->ID; } else { echo "defail"; } } }