当前位置: 首页>>代码示例>>PHP>>正文


PHP User::count方法代码示例

本文整理汇总了PHP中app\User::count方法的典型用法代码示例。如果您正苦于以下问题:PHP User::count方法的具体用法?PHP User::count怎么用?PHP User::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\User的用法示例。


在下文中一共展示了User::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: status

 public function status($statusType)
 {
     if (1 == $statusType) {
         $buildingNumber = Building::count();
         $roomNumber = Room::count();
         $buildingRet = ['buildingNumber' => $buildingNumber, 'roomNumber' => $roomNumber];
         return $buildingRet;
     } else {
         if (2 == $statusType) {
             $roomNumber = Room::count();
             $rentedRoomNumber = Contract::count();
             $emptyRoomNumber = $roomNumber - $rentedRoomNumber;
             $rentRet = ['roomNumber' => $roomNumber, 'rentedNumber' => $rentedRoomNumber, 'emptyNumber' => $emptyRoomNumber];
             return $rentRet;
         } else {
             if (3 == $statusType) {
                 $feePlanItem = DB::select('SELECT COUNT(DISTINCT feemeta_id) as counts FROM fee_plans WHERE status=0 AND deleted_at IS NULL');
                 $feePlanRentNumber = DB::select('SELECT COUNT(DISTINCT rent_id) as counts FROM fee_plans WHERE status=0 AND deleted_at IS NULL');
                 $feeRet = ['feePlanNumber' => $feePlanItem[0]->counts, 'feePlanRentNumber' => $feePlanRentNumber[0]->counts];
                 return $feeRet;
             } else {
                 if (4 == $statusType) {
                     $userNumber = User::count();
                     $userRet = ['userCount' => $userNumber];
                     return $userRet;
                 }
             }
         }
     }
 }
开发者ID:boybin,项目名称:n4backend,代码行数:30,代码来源:IndexController.php

示例2: getHomepage

 /**
  * Get homepage
  *
  * @param Request $request
  * @return View|void
  */
 public function getHomepage(Request $request)
 {
     /**
      * Load data
      */
     $this->_arViewData = $this->_loadPageByUrl('/');
     /**
      * Number of users
      */
     $this->_arViewData['users_no'] = User::count() + 135000;
     /**
      * Number of campaigns
      */
     $this->_arViewData['campaigns_no'] = Campaign::count();
     /**
      * Number of payments total
      */
     $this->_arViewData['payments_no_total'] = Payment::sum('amount');
     /**
      * Number of payments last month
      */
     $this->_arViewData['payments_no_last_month'] = Payment::where('created_at', '>=', Carbon::now()->subMonth())->count();
     /**
      * Return view
      */
     return $this->_showViewOr404('frontend.homepage');
 }
开发者ID:jdrda,项目名称:olapus,代码行数:33,代码来源:PageController.php

示例3: index

 public function index(ArticleRepository $article, MarketRepository $market)
 {
     $article_counts = $article->publishedCountWithCommentCount();
     $user_count = \App\User::count();
     $event_count = $market->currentAndFutureCount();
     return view('backend.page.index', compact('article_counts', 'user_count', 'event_count'));
 }
开发者ID:jekinney,项目名称:gypsy-v-3,代码行数:7,代码来源:PageController.php

示例4: challenges

 public function challenges()
 {
     /*$game = Game::first();
             $categories = Category::get();
             $categories = $categories->toArray();
     
             foreach($categories as $category)
             {
                 $challenges = Challenge::where('category_id', $category['id'])->get()->toArray();
                 $categories[(int)$category['id'] - 1]['challenges'] =  $challenges;
             }
     
     
             $data = array('game' => $game, 'categories' => $categories);*/
     $num_users = User::count();
     $completed = Submitted_flag::count();
     $num_challenges = Challenge::count();
     $average_c = $completed / $num_users / $num_challenges * 100;
     $stats = array('num_users' => $num_users, 'completed' => $completed, 'average' => $average_c);
     $game = Game::first();
     $categories = Category::get();
     $categories = $categories->toArray();
     foreach ($categories as $category) {
         $challenges = Challenge::where('category_id', $category['id'])->get()->toArray();
         $categories[(int) $category['id'] - 1]['challenges'] = $challenges;
     }
     $directory = base_path() . '/public/Challenges_Repo/';
     $files = scandir($directory);
     $data = array('user' => Auth::user(), 'game' => $game, 'categories' => $categories, 'stats' => $stats, 'files' => $files);
     return view("pages.challenges")->with('data', $data);
 }
开发者ID:Gustibimo,项目名称:CTF-Challenge,代码行数:31,代码来源:DynamicController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $users_count = User::count();
     $posts_count = Post::count();
     $galleries_count = Gallery::count();
     return response()->json(['users_count' => $users_count, 'posts_count' => $posts_count, 'galleries_count' => $galleries_count]);
 }
开发者ID:szwork2013,项目名称:laravel-angular-cms,代码行数:12,代码来源:DashboardController.php

示例6: index

 /**
  * Display a dashboard.
  *
  * @return Response
  */
 public function index()
 {
     $userCount = User::count();
     $pagesCount = Page::count();
     $newsCount = News::count();
     return view('util.index', compact('userCount', 'pagesCount', 'newsCount'));
 }
开发者ID:vowsdesrat,项目名称:laravel,代码行数:12,代码来源:AuthExtendedController.php

示例7: index

 public function index()
 {
     $title = "Dashboard";
     $users = User::count();
     $operation_areas = Operation_area::select()->get();
     return view('admin.dashboard.index', compact('title', 'users', 'operation_areas'));
 }
开发者ID:sea-watch,项目名称:sea-watch-app,代码行数:7,代码来源:DashboardController.php

示例8: index

 /**
  * Display the dashboard once the user is logged
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $nb_users = User::count();
     $nb_posts = Post::count();
     $nb_pages = Page::count();
     return view('admin.admin', compact('nb_users', 'nb_posts', 'nb_pages'));
 }
开发者ID:victorboissiere,项目名称:Synergie,代码行数:12,代码来源:DashboardController.php

示例9: dashboard

 public function dashboard(Request $request)
 {
     $stat = new \Stdclass();
     $stat->num_ads = Ad::count();
     $stat->num_promo_ads = Ad::where('ad_promo', 1)->count();
     $stat->users = User::count();
     $stat->reports = AdReport::count();
     //get last 10 days ads
     $ads_by_date = Ad::select(DB::raw("count(ad_id) AS ad_count, DATE_FORMAT(ad_publish_date, '%Y-%m-%d') AS date_formated"))->groupBy('date_formated')->orderBy('date_formated', 'desc')->take(10)->get()->toArray();
     $stat->ads_by_date = [];
     if (!empty($ads_by_date)) {
         $stat->ads_by_date = array_reverse($ads_by_date);
     }
     //get last 10 promo days ads
     $promo_ads_by_date = Ad::select(DB::raw("count(ad_id) AS ad_count, DATE_FORMAT(ad_publish_date, '%Y-%m-%d') AS date_formated"))->where('ad_promo', 1)->groupBy('date_formated')->orderBy('date_formated', 'desc')->take(10)->get()->toArray();
     $stat->promo_ads_by_date = [];
     if (!empty($promo_ads_by_date)) {
         $stat->promo_ads_by_date = array_reverse($promo_ads_by_date);
     }
     //get last 10 months ads
     $ads_by_month = Ad::select(DB::raw("count(ad_id) AS ad_count, DATE_FORMAT(ad_publish_date, '%Y-%m') AS date_formated"))->groupBy('date_formated')->orderBy('date_formated', 'desc')->take(10)->get()->toArray();
     $stat->ads_by_month = [];
     if (!empty($ads_by_month)) {
         $stat->ads_by_month = array_reverse($ads_by_month);
     }
     //get last 10 years ads
     $ads_by_year = Ad::select(DB::raw("count(ad_id) AS ad_count, DATE_FORMAT(ad_publish_date, '%Y') AS date_formated"))->groupBy('date_formated')->orderBy('date_formated', 'desc')->take(10)->get()->toArray();
     $stat->ads_by_year = [];
     if (!empty($ads_by_year)) {
         $stat->ads_by_year = array_reverse($ads_by_year);
     }
     return view('admin.dashboard.dashboard', ['stat' => $stat]);
 }
开发者ID:gdinko,项目名称:dclassifieds.laravel,代码行数:33,代码来源:AdminController.php

示例10: challenges

 public function challenges()
 {
     $startd = DB::table('Games')->select('start')->first();
     $endd = DB::table('Games')->select('stop')->first();
     if ($startd->start > Carbon::now()) {
         return view("pages.countdown");
     } elseif ($endd->stop < Carbon::now()) {
         return view('pages.closed');
     }
     $num_users = User::count();
     $completed = Submitted_flag::count();
     $num_challenges = Challenge::count();
     $average_c = $completed / $num_users / $num_challenges * 100;
     $stats = array('num_users' => $num_users, 'completed' => $completed, 'average' => $average_c);
     $mycompleted = Submitted_flag::where('user_id', Auth::user()->id)->get()->toArray();
     $game = Game::first();
     $categories = Category::get();
     $categories = $categories->toArray();
     foreach ($categories as $category) {
         $challenges = Challenge::where('category_id', $category['id'])->orderby('point_value', 'ASC')->get()->toArray();
         $categories[(int) $category['id'] - 1]['challenges'] = $challenges;
     }
     $directory = base_path() . '/public/Challenges_Repo/';
     $files = scandir($directory);
     $startd = DB::table('Games')->select('start')->first();
     if ($startd->start > Carbon::now()) {
         $start = true;
     } else {
         $start = false;
     }
     $data = array('user' => Auth::user(), 'game' => $game, 'categories' => $categories, 'stats' => $stats, 'files' => $files, 'completed' => $mycompleted, 'start' => $start);
     return view("pages.challenges")->with('data', $data);
 }
开发者ID:Kanesol,项目名称:CTF-Challenge,代码行数:33,代码来源:DynamicController.php

示例11: testGet

 public function testGet()
 {
     $users = User::get();
     $this->assertEquals(3, $users->count());
     $users = User::where('id', '>', 1)->get();
     $this->assertEquals(2, $users->count());
     // test chunk
     User::chunk(2, function ($users) {
         foreach ($users as $user) {
             $this->assertInternalType('int', $user->id);
         }
     });
     User::chunk(1, function ($users) {
         $this->assertInstanceOf('Illuminate\\Support\\Collection', $users);
     });
     // test find with query builder
     $user = User::where('id', '>', 1)->find(1);
     $this->assertNull($user);
     $user = User::where('id', '>', 1)->find(2);
     $this->assertEquals(2, $user->id);
     // test first without query builder
     $user = User::first();
     $this->assertInstanceOf('App\\User', $user);
     // test retrieving aggregates
     $max_id = User::max('id');
     $this->assertGreaterThanOrEqual(3, $max_id);
     $count = User::count();
     $this->assertGreaterThanOrEqual(3, $count);
     $sum = User::sum('id');
     $this->assertGreaterThanOrEqual(6, $sum);
 }
开发者ID:richarddlu,项目名称:test_eloquent,代码行数:31,代码来源:EloquentTest.php

示例12: tableRowCount

 public static function tableRowCount($col, $met, $val)
 {
     if (strlen(trim($val)) > 0) {
         return User::where(DB::raw($col), $met, '%' . str_replace(' ', '%', $val) . '%')->count();
     } else {
         return User::count();
     }
 }
开发者ID:4andrisbriedis,项目名称:test,代码行数:8,代码来源:User.php

示例13: index

 public function index()
 {
     $title = "Dashboard";
     $questions = Question::count();
     $questioncategories = QuestionCategory::count();
     $users = User::count();
     return view('admin.dashboard.index', compact('title', 'questions', 'questioncategories', 'countries', 'users'));
 }
开发者ID:alex311982,项目名称:laravel5_online_support,代码行数:8,代码来源:DashboardController.php

示例14: index

 public function index()
 {
     $article_num = Article::count();
     $articles = Article::sortByDesc('id')->take(5)->get();
     $user_num = User::count();
     $users = User::sortByDesc('id')->take(5)->get();
     return Theme::view('admin.dash.index', compact(['article_num', 'user_num', 'articles', 'users']));
 }
开发者ID:baitongda,项目名称:timeCMS-free,代码行数:8,代码来源:DashController.php

示例15: index

 public function index()
 {
     $userCount = User::count();
     $articleCount = Article::count();
     $tagCount = Tag::count();
     $imageCount = Image::count();
     return view('admin.index', compact('userCount', 'articleCount', 'imageCount', 'tagCount'));
 }
开发者ID:litemax,项目名称:LaravelBlog,代码行数:8,代码来源:IndexController.php


注:本文中的app\User::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。