本文整理匯總了PHP中Artist::count方法的典型用法代碼示例。如果您正苦於以下問題:PHP Artist::count方法的具體用法?PHP Artist::count怎麽用?PHP Artist::count使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Artist
的用法示例。
在下文中一共展示了Artist::count方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
/**
* 首頁
*
* @param Request $request
* @return Response
*/
public function index(Request $request)
{
// get params
$cate = $request::get('cate', 'all');
$limit = 'all' === $cate ? $request::get('limit', 50) : 100000;
$isFlush = $request::get('flush');
// cache it
$cacheKey = Music::INDEX_ALL_CACHE_PREFIX . $cate;
$archive = Cache::get($cacheKey);
if ($isFlush or empty($archive)) {
// collect data
$data = [];
if (in_array($cate, ['all', 'music'])) {
$musics = Music::select('id', 'title', 'album', 'counts')->orderBy('counts', 'desc')->take($limit)->get();
$musicCounts = Music::count();
$data['music'] = ['list' => $musics, 'counts' => $musicCounts];
}
if (in_array($cate, ['all', 'artist'])) {
$artists = Artist::orderBy('counts', 'desc')->take($limit)->get();
$artistCounts = Artist::count();
$data['artist'] = ['list' => $artists, 'counts' => $artistCounts];
}
// TDK
$title = '飛魚秀 の 大歌單';
if ('artist' === $cate) {
$title = $title . ' - 全部歌手';
}
if ('music' === $cate) {
$title = $title . ' - 全部歌曲';
}
$description = '飛魚秀歌單, 飛魚秀音樂列表';
// render
$archive = (string) View::make('music.index.archive')->with('data', $data)->with('cate', $cate)->with('limit', $limit)->with('title', $title)->with('description', $description);
Cache::forever($cacheKey, $archive);
}
// render page
return View::make('music.index.frame')->with('archive', $archive);
}