public function actionTest() { // returns record id not user_id $id = UserSetting::initialize(Yii::$app->user->getId()); echo $id; $model = new UserSetting(); $model = $this->findModel($id); if ($model->load(Yii::$app->request->post())) { echo ' nope'; } return $this->render('test', ['model' => $model]); }
/** * Default path - redirect to update * @return mixed */ public function actionIndex() { // returns record id not user_id $id = UserSetting::initialize(Yii::$app->user->getId()); return $this->redirect(['update', 'id' => $id]); }