/** * 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(); $model->status = User::STATUS_NOT_ACTIVE; if ($model->load(Yii::$app->request->post())) { if ($model->save()) { $assign = new AuthAssignment(); $assign->item_name = 'user'; $assign->user_id = $model->id; $assign->created_at = time(); $assign->save(false); } return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }