public function removePost($post, $user = null)
{
DB::transaction(function () use($post, $user) {
$post->delete();
if ($this->posts()->exists() === true) {
$this->refreshCache();
} else {
$this->deleteWithDependencies();
}
if ($this->forum !== null) {
$this->forum->refreshCache();
}
if ($post->user !== null) {
$post->user->refreshForumCache($this->forum, -1);
}
if ($user !== null && $user->user_id !== $post->poster_id) {
Log::logModerateForumPost('LOG_DELETE_POST', $post);
}
});
return true;
}