本文整理汇总了PHP中app\Board::whereIndexed方法的典型用法代码示例。如果您正苦于以下问题:PHP Board::whereIndexed方法的具体用法?PHP Board::whereIndexed怎么用?PHP Board::whereIndexed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Board
的用法示例。
在下文中一共展示了Board::whereIndexed方法的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;
}