public function actionDeletePost()
 {
     $selection = (array) Yii::$app->request->post('selection');
     foreach ($selection as $id) {
         Post::deleteAll(['id' => $id]);
         Like::deleteAll(['post_id' => $id]);
         Comment::deleteAll(['post_id' => $id]);
         PostTag::deleteAll(['post_id' => $id]);
         PostNotification::deleteAll(['post_id' => $id]);
         PostProtected::deleteAll(['post_id' => $id]);
     }
     return $this->render('post-manage');
 }
 public function actionUnlike()
 {
     if (Yii::$app->user->isGuest) {
         $this->redirect(Url::to(['/site/login']));
     }
     if (isset($_POST['id'])) {
         Like::deleteAll(['user_id' => Yii::$app->user->getId(), 'post_id' => $_POST['id']]);
         PostNotification::deleteAll(['post_id' => $_POST['id'], 'type' => 0, 'action_id' => Yii::$app->user->getId()]);
     }
 }