コード例 #1
0
 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]);
 }
コード例 #2
0
 /**
  * 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]);
 }