logModerateForumPost() public static method

public static logModerateForumPost ( $operation, $post, $user = null )
Beispiel #1
0
 public function removePost($post, $user = null)
 {
     DB::transaction(function () use($post, $user) {
         $post->delete();
         if ($this->posts()->exists() === true) {
             $this->refreshCache();
         } else {
             $this->deleteWithCover();
         }
         if ($this->forum !== null) {
             $this->forum->refreshCache();
         }
         if ($post->user !== null) {
             $post->user->refreshForumCache();
         }
         if ($user !== null && $user->user_id !== $post->poster_id && $user->isAdmin() === true) {
             Log::logModerateForumPost('LOG_DELETE_POST', $post);
         }
     });
     return true;
 }
Beispiel #2
0
 public function edit($body, $user)
 {
     if ($body === $this->bodyRaw) {
         return true;
     }
     $updates = ['post_text' => $body];
     if ($user->user_id === $this->poster_id) {
         $updates = array_merge($updates, ['post_edit_time' => Carbon::now(), 'post_edit_count' => DB::raw('post_edit_count + 1'), 'post_edit_user' => $user->user_id]);
     } else {
         Log::logModerateForumPost('LOG_POST_EDITED', $this);
     }
     return $this->update($updates);
 }