本文整理汇总了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);
}