示例#1
0
 public function actionDeleteUser()
 {
     $selection = (array) Yii::$app->request->post('selection');
     foreach ($selection as $id) {
         if ($id != Yii::$app->params['adminId']) {
             User::deleteAll(['id' => $id]);
             Post::deleteAll(['user_id' => $id]);
             PostNotification::deleteAll(['action_id' => $id]);
             PostNotification::deleteAll(['receiver_id' => $id]);
             Comment::deleteAll(['user_id' => $id]);
             Like::deleteAll(['user_id' => $id]);
             Message::deleteAll(['sender_id' => $id]);
             Message::deleteAll(['receiver_id' => $id]);
             Relationship::deleteAll(['user_id_1' => $id]);
             Relationship::deleteAll(['user_id_2' => $id]);
             RelationshipNotification::deleteAll(['action_id' => $id]);
             RelationshipNotification::deleteAll(['receive_id' => $id]);
             Schedule::deleteAll(['own_id' => $id]);
             ScheduleNotification::deleteAll(['action_id' => $id]);
             ScheduleNotification::deleteAll(['receiver_id' => $id]);
         }
     }
     return $this->render('user-manage');
 }
示例#2
0
 public function actionDeclineReceivedSchedule($id)
 {
     ScheduleNotification::deleteAll(['id' => $id]);
     $this->redirect('?r=schedule/create-event');
 }