frontend/controllers/setting/UserController.php
/**
     * Creates a new User model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @param null $space
     * @return mixed
     */
Creates a new User model.
If creation is successful, the browser will be redirected to the 'view' page.
@param null $space
@return mixed
Creates a new User model . If creation is successful the browser will be redirected to the ' view ' page . @param null $space @return mixed
public function actionCreate($space = null)
    {
        $model = new CreateUserForm();
        $user = User::findOne(Yii::$app->user->getId());
        $model->company_id = $user->company_id;
        if ($space){
            $model->space_id = $space;
        }else {
            $model->space_id = $user->space_id;
        }
        if ($model->load(Yii::$app->request->post()) && $model->create()) {
            return $this->redirect(['index']);
        }
        return $this->render('create', [
            'model' => $model,
        ]);
    }
public function actionCreate ( $ space = null ) { $ model = new CreateUserForm ( ) ; $ user = User :: findOne ( Yii :: $ app -> user -> getId ( ) ) ; $ model -> company_id = $ user -> company_id ; if ( $ space ) { $ model -> space_id = $ space ; } else { $ model -> space_id = $ user -> space_id ; } if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> create ( ) ) { return $ this -> redirect ( [ 'index' ] ) ; } return $ this -> render ( 'create' , [ 'model' => $ model , ] ) ; }
Creates a new User model.
Creates a new User model .