/** * Shows the Index Page * * @param Store $settings * * @return \Illuminate\View\View */ public function index(Store $settings) { // Forum permissions are checked in "getIndexTree" and "getNewest" $forums = $this->forumRepository->getIndexTree(); $topics = $this->topicRepository->getNewest(); $users = $this->userRepository->online($settings->get('wio.minutes', 15), 'name', 'asc', 0); return view('forum.index', compact('forums', 'topics', 'users')); }
/** * @return \Illuminate\View\View */ public function index() { // Forum permissions are checked in "getIndexTree" $forumsList = $this->forumRepository->getIndexTree(); $forums = []; $makeLists = function (&$forums, &$list, $tab = '') use(&$makeLists) { foreach ($list as $forum) { $forums[$forum->id] = $tab . $forum->title; if (!empty($forum->children)) { $makeLists($forums, $forum->children, $tab . ' '); } } }; $makeLists($forums, $forumsList); return view('search.index', compact('forums')); }
/** * Get the forum tree for the index, consisting of root forums (categories), and one level of descendants. * * @param bool $checkPermissions * * @return mixed */ public function getIndexTree($checkPermissions = true) { if (($forums = $this->cache->get('forums.index_tree')) == null) { $forums = $this->decoratedRepository->getIndexTree(false); $this->cache->forever('forums.index_tree', $forums); } if ($checkPermissions) { $forums = $this->filterUnviewableForums($forums); } return $forums; }