本文整理匯總了PHP中app\Board::sum方法的典型用法代碼示例。如果您正苦於以下問題:PHP Board::sum方法的具體用法?PHP Board::sum怎麽用?PHP Board::sum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Board
的用法示例。
在下文中一共展示了Board::sum方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: boardStats
/**
* 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::whereIndexed()->count();
break;
case "boardIndexedCount":
$stats[$boardStat] = Board::count();
break;
case "postCount":
$stats[$boardStat] = Board::sum('posts_total');
break;
case "postRecentCount":
$stats[$boardStat] = Post::recent()->count();
break;
}
}
return $stats;
});
return $stats;
}
示例2: boardStats
/**
* 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 "boardIndexedCount":
$stats[$boardStat] = Board::whereIndexed()->count();
break;
case "startDate":
$stats[$boardStat] = Board::orderBy('created_at', 'desc')->take(1)->pluck('created_at')->format("M jS, Y");
break;
case "boardTotalCount":
$stats[$boardStat] = Board::count();
break;
case "postCount":
$stats[$boardStat] = Board::sum('posts_total');
break;
case "postRecentCount":
$stats[$boardStat] = Post::recent()->count();
break;
}
}
return $stats;
});
return $stats;
}