Пример #1
0
 /**
  * Restore a post
  *
  * @param Post $post The post to restore
  *
  * @return mixed
  */
 public function restorePost(Post $post)
 {
     $post->topic->increment('num_posts');
     $post->topic->forum->increment('num_posts');
     if ($post->user_id > 0) {
         $post->author->increment('num_posts');
     }
     $success = $post->restore();
     if ($success) {
         if ($post->id > $post->topic->last_post_id) {
             $post->topic->update(['last_post_id' => $post->id]);
         }
         if ($post->id > $post->topic->forum->last_post_id) {
             $this->forumRepository->updateLastPost($post->topic->forum, $post);
         }
     }
     return $success;
 }