コード例 #1
0
 /**
  * Updates an existing User social links.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $change = new NotifUserHelper();
         $followersNotified = null;
         if ($model->isAttributeChanged('linkedin')) {
             $followersNotified = $change->userChangedLinkedIn($id);
         }
         if ($model->isAttributeChanged('github')) {
             $followersNotified = $change->userChangedGithub($id);
         }
         return $this->redirect(['index', 'followersNotified' => $followersNotified]);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }