コード例 #1
0
 /**
  * Disconnects a network account from user.
  * @param  integer $id
  * @return \yii\web\Response
  * @throws \yii\web\NotFoundHttpException
  * @throws \yii\web\ForbiddenHttpException
  */
 public function actionDisconnect($id)
 {
     $account = $this->finder->findAccountById($id);
     if ($account === null) {
         throw new NotFoundHttpException();
     }
     if ($account->user_id != \Yii::$app->user->id) {
         throw new ForbiddenHttpException();
     }
     $account->delete();
     return $this->redirect(['networks']);
 }