コード例 #1
0
ファイル: Forum.php プロジェクト: echojc/osu-web
 public function lastTopic($withSubforums = true)
 {
     if ($this->lastTopic === null) {
         $this->lastTopic = [Topic::whereIn('forum_id', $this->allSubforums())->orderBy('topic_last_post_time', 'desc')->first()];
     }
     return $this->lastTopic[0];
 }
コード例 #2
0
ファイル: Forum.php プロジェクト: ameliaikeda/osu-web
 public function lastTopic($recursive = true)
 {
     $key = $recursive === true ? 'recursive' : 'current';
     if (isset($this->_lastTopic[$key]) === false) {
         $this->_lastTopic[$key] = Topic::whereIn('forum_id', $recursive ? $this->allSubforums() : [$this->forum_id])->orderBy('topic_last_post_time', 'desc')->first();
     }
     return $this->_lastTopic[$key];
 }
コード例 #3
0
 public function unwatchMulti()
 {
     $topicIds = explode(',', Request::input('topic_ids'));
     $topics = Topic::whereIn('topic_id', $topicIds);
     $unwatchTopics = $topics->get()->filter(function ($t) {
         return priv_check('ForumTopicWatchRemove', $t)->can();
     });
     TopicWatch::remove($unwatchTopics, Auth::user());
     return ['message' => trans('forum.topics.watch.watched-0')];
 }