當前位置: 首頁>>代碼示例>>PHP>>正文


PHP News::count方法代碼示例

本文整理匯總了PHP中app\News::count方法的典型用法代碼示例。如果您正苦於以下問題:PHP News::count方法的具體用法?PHP News::count怎麽用?PHP News::count使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\News的用法示例。


在下文中一共展示了News::count方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: index

 public function index()
 {
     $title = "Dashboard";
     $news = News::count();
     $newscategory = NewsCategory::count();
     $users = User::count();
     $photo = Photo::count();
     $photoalbum = PhotoAlbum::count();
     $video = Video::count();
     $videoalbum = VideoAlbum::count();
     return view('admin.dashboard.index', compact('title', 'news', 'newscategory', 'video', 'videoalbum', 'photo', 'photoalbum', 'users'));
 }
開發者ID:ryleto,項目名稱:nightjar,代碼行數:12,代碼來源:DashboardController.php

示例3: 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]);
 }
開發者ID:fuzhongqing,項目名稱:newoj,代碼行數:18,代碼來源:DashboardController.php

示例4: showNewsAction

 public function showNewsAction()
 {
     if (!isset($_GET['page_number'])) {
         $page_number = 1;
     } else {
         $page_number = $_GET['page_number'];
     }
     $news = News::latest('created_at')->skip(($page_number - 1) * 5)->take(5)->get();
     $news_count = News::count();
     return view('admin.show_news', ['news' => $news, 'page_number' => $page_number, 'news_count' => $news_count]);
 }
開發者ID:chelizminska,項目名稱:laravel_new,代碼行數:11,代碼來源:BaseController.php


注:本文中的app\News::count方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。