logModerateForumTopicMove() public static méthode

public static logModerateForumTopicMove ( $topic, $originForum, $user = null )
Exemple #1
0
 public function moveTo($destinationForum)
 {
     if ($this->forum_id === $destinationForum->forum_id) {
         return true;
     }
     if (!$this->forum->isOpen()) {
         return false;
     }
     return DB::transaction(function () use($destinationForum) {
         $originForum = $this->forum;
         $this->forum()->associate($destinationForum);
         $this->save();
         $this->posts()->update(['forum_id' => $destinationForum->forum_id]);
         $this->logs()->update(['forum_id' => $destinationForum->forum_id]);
         $this->userTracks()->update(['forum_id' => $destinationForum->forum_id]);
         if ($originForum !== null) {
             $originForum->refreshCache();
         }
         if ($this->forum !== null) {
             $this->forum->refreshCache();
         }
         $users = User::whereIn('user_id', model_pluck($this->posts(), 'poster_id'))->get();
         foreach ($users as $user) {
             $user->refreshForumCache();
         }
         Log::logModerateForumTopicMove($this, $originForum);
         return true;
     });
 }