本文整理汇总了PHP中app\Group::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::count方法的具体用法?PHP Group::count怎么用?PHP Group::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Group
的用法示例。
在下文中一共展示了Group::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display admin index.
*
* @return Response
*/
public function index()
{
if (Gate::denies('admin')) {
Auth::logout();
return redirect('/admin/login');
}
// Display total numbers
$groups = Group::count();
$members = Member::count();
$ideas = Idea::count();
return view('admin.dashboard', ['groups' => $groups, 'members' => $members, 'ideas' => $ideas]);
}
示例2: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$role = Auth::user()->roles;
$admin_count = 1 << 0 & $role ? User::where('roles', '>', '0')->count() : -1;
$problem_count = 1 << 1 & $role ? Problem::count() : -1;
$user_count = 1 << 2 & $role ? User::count() : -1;
$contest_count = 1 << 3 & $role ? Contest::count() : -1;
$group_count = 1 << 4 & $role ? Group::count() : -1;
$news_count = 1 << 5 & $role ? News::count() : -1;
$discuss_count = 0;
$runinfo_count = 1 << 7 & $role ? Status::count() : -1;
return response()->json(['admin_count' => $admin_count, 'problem_count' => $problem_count, 'user_count' => $user_count, 'contest_count' => $contest_count, 'group_count' => $group_count, 'news_count' => $news_count, 'discuss_count' => $discuss_count, 'runinfo_count' => $runinfo_count]);
}