本文整理汇总了PHP中Artists::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Artists::count方法的具体用法?PHP Artists::count怎么用?PHP Artists::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Artists
的用法示例。
在下文中一共展示了Artists::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sidebar
function sidebar()
{
$return .= "\n\t<h4>Music Library</h4>\n\t<dl>\n\t\t<dt>Tracks</dt>\n\t\t<dd>" . number_format(Tracks::get_total_tracks()) . "</dd>\n\t\t<dt>Artists</dt>\n\t\t<dd>" . number_format(Artists::count()) . "</dd>\n\t\t<dt>Albums</dt>\n\t\t<dd>" . number_format(Albums::count()) . "</dd>\n\t</dl>";
function bytes($a)
{
$unim = array("B", "KB", "MB", "GB", "TB", "PB");
$c = 0;
while ($a >= 1024) {
$c++;
$a = $a / 1024;
}
return number_format($a, $c ? 2 : 0, ".", ",") . " " . $unim[$c];
}
$return .= "\n\t<h4>Archive Storage</h4>\n\t<dl>";
foreach (Archives::get_all() as $archive) {
$pc = (int) (100 - $archive->get_free_space() / $archive->get_total_space() * 100);
if ($archive->get_free_space() > 536870912000.0) {
$colour = "success";
} else {
if ($archive->get_free_space() > 214748364800.0) {
$colour = "warning";
} else {
$colour = "danger";
}
}
$return .= "\n\t\t<dt>" . $archive->get_name() . "</dt>\n\t\t<dd><div class=\"progress\" style=\"margin: 3px 0px; \"><div class=\"progress-bar progress-bar-" . $colour . "\" style=\"width: " . $pc . "%;\"></div></div></dd>\n\t\t<dd>" . bytes($archive->get_free_space()) . " free of " . bytes($archive->get_total_space()) . "</dd>";
}
$return .= "</dl>";
return $return;
}
示例2: getAdmin
public function getAdmin()
{
//Get info
$data['users'] = User::paginate(5);
$data['recent_books'] = Comicbooks::select('book_name', 'updated_at')->orderBy('updated_at', 'desc')->paginate(3);
$data['user_count'] = User::where('id', '>', 0)->count();
$data['publisher_count'] = Publishers::where('id', '>', 0)->count();
$data['books_count'] = Comicbooks::where('id', '>', 0)->count();
$data['issue_count'] = Comicissues::where('issue_id', '>', 0)->where('book_id', '>', 0)->count();
$data['artist_count'] = Artists::count();
$data['author_count'] = Authors::count();
$data['books_created'] = Comicbooks::select(DB::raw('count(*) as count'), 'created_at')->groupby(DB::raw('date_format(created_at, "%b %Y")'))->orderby('created_at', 'asc')->get();
$data['issues_created'] = Comicissues::select(DB::raw('count(*) as count'), 'created_at')->groupby(DB::raw('date_format(created_at, "%b %Y")'))->orderby('created_at', 'asc')->get();
//Check if there are any comicbook series
if (count($data['books_created']) > 0) {
//Get the count of books per the month/year then return the json encoded string
foreach ($data['books_created'] as $created) {
$created_books[] = $created->count;
$created_books_date[] = date_format($created->created_at, "M Y");
}
$data['created_books'] = json_encode($created_books);
}
//Check if there are any comicbook issue
if (count($data['issues_created']) > 0) {
//Get the count of issues per the month/year then return the json encoded string
foreach ($data['issues_created'] as $created) {
$created_issues[] = $created->count;
$created_issues_date[] = date_format($created->created_at, "M Y");
}
$data['created_issues'] = json_encode($created_issues);
}
//Merge dates from comicbook series and issues created then return the json encoded string
$data['created_dates'] = json_encode(array_unique(array_merge($created_issues_date, $created_books_date)));
$this->layout->content = View::make('admin.index', $data);
}