/** * Returns the information specified by boardStats * * @return array (indexes and vales based on $boardStats) */ protected function boardStats() { $controller =& $this; $stats = Cache::remember('index.boardstats', 60, function () use($controller) { $stats = []; foreach ($controller->boardStats as $boardStat) { switch ($boardStat) { case "boardCount": $stats[$boardStat] = Board::indexed()->count(); break; case "boardIndexedCount": $stats[$boardStat] = Board::count(); break; case "postCount": $stats[$boardStat] = Post::count(); break; case "postRecentCount": $stats[$boardStat] = Post::recent()->count(); break; } } return $stats; }); return $stats; }