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


PHP Article::count方法代碼示例

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


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

示例1: overview

 public function overview()
 {
     $total = Article::count();
     $star = Article::where('star_ind', '1')->count();
     $read = Article::where('status', 'read')->count();
     $unread = $total - $read;
     return response()->json(compact('total', 'star', 'read', 'unread'));
 }
開發者ID:yuansir,項目名稱:rssmonster,代碼行數:8,代碼來源:ArticleController.php

示例2: index

 public function index()
 {
     $article_count = Article::count();
     $category_count = Category::count();
     $tag_count = Tag::count();
     $user_count = User::count();
     return view('admin.console', compact('article_count', 'category_count', 'tag_count', 'user_count'));
 }
開發者ID:axhello,項目名稱:laravel-blog-demo,代碼行數:8,代碼來源:AdminController.php

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

示例4: index

 public function index()
 {
     $title = "Dashboard";
     $article = Article::count();
     $articlecategory = ArticleCategory::count();
     $users = User::count();
     $photo = Photo::count();
     $photoalbum = PhotoAlbum::count();
     return view('admin.dashboard.index', compact('title', 'article', 'articlecategory', 'photo', 'photoalbum', 'users'));
 }
開發者ID:bee7er,項目名稱:brianetheridge_laravel_v2,代碼行數:10,代碼來源:DashboardController.php

示例5: composeDashboard

 private function composeDashboard()
 {
     view()->composer('admin.index', function ($view) {
         $numArticle = \App\Article::count();
         $numCategory = \App\Category::count();
         $numTag = \App\Tag::count();
         $numProject = \App\Project::count();
         $numMessage = \App\Message::count();
         $view->with(compact('numArticle', 'numCategory', 'numTag', 'numProject', 'numMessage'));
     });
 }
開發者ID:ambarsetyawan,項目名稱:laravel5-blog-1,代碼行數:11,代碼來源:DashboardViewComposerServiceProvider.php

示例6: index

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

示例7: Home

 public function Home(Request $request)
 {
     $page = (int) ($request->get('p', '1') > 0 ? $request->get('p', '1') : 1);
     $isPageMax = false;
     $articles = Article::orderBy('publish_at', 'desc')->orderBy('id', 'desc')->skip(($page - 1) * 10)->take(10)->get();
     if (count($articles) == 0 && $page > 1) {
         $pagemax = ceil(Article::count() / 10);
         return Redirect::route('adminArticles', array('p' => $pagemax));
     }
     $nextArticles = Article::orderBy('publish_at', 'desc')->orderBy('id', 'desc')->skip($page * 10)->take(1)->get();
     if (count($nextArticles) == 0) {
         $isPageMax = true;
     }
     return view('admin.articles.home', compact('page', 'isPageMax', 'articles'));
 }
開發者ID:kbiyo,項目名稱:ARTTv2,代碼行數:15,代碼來源:ArticlesController.php

示例8: getFever

 public function getFever()
 {
     /* Fever API needs strings for category_id and feed_id's */
     //static for now
     $email = 'username';
     $pass = 'password';
     $api_key = md5($email . ':' . $pass);
     //always return status 1: password and username correct
     $status = '1';
     //latest api version is 3
     $arr = ['api_version' => '3', 'auth' => $status];
     //last refreshed is current system time
     $time = ['last_refreshed_on_time' => strtotime('now')];
     $arr = array_merge($arr, $time);
     //when argument is groups, retrieve list with categories and id's
     if (isset($_GET['groups'])) {
         $groups = [];
         $Categories = Category::orderBy('category_order', 'asc')->get();
         if (!empty($Categories)) {
             foreach ($Categories as $Category) {
                 array_push($groups, ['id' => (string) $Category->id, 'title' => $Category->name]);
             }
         }
         $response_arr['groups'] = $groups;
         $arr = array_merge($arr, $response_arr);
     }
     //when argument is feeds, retrieve list with feeds and id's
     if (isset($_GET['feeds'])) {
         $feeds = [];
         $Feeds = Feed::orderBy('feed_name', 'asc')->get();
         if (!empty($Feeds)) {
             foreach ($Feeds as $Feed) {
                 array_push($feeds, ['id' => (int) $Feed->id, 'favicon_id' => (int) $Feed->id, 'title' => $Feed->feed_name, 'url' => $Feed->url, 'site_url' => $Feed->url, 'is_spark' => '0', 'last_updated_on_time' => strtotime($Feed->updated_at)]);
             }
         }
         $response_arr['feeds'] = $feeds;
         $arr = array_merge($arr, $response_arr);
     }
     //when argument is groups or feeds, also return feed id's linked to category id's
     if (isset($_GET['groups']) || isset($_GET['feeds'])) {
         $feeds_groups = [];
         //The array is composed with a group_id and feed_ids containing a string/comma-separated list of positive integers
         $Categories = Category::orderBy('category_order', 'asc')->get();
         if (!empty($Categories)) {
             foreach ($Categories as $key => $Category) {
                 $feeds_groups[$key]['group_id'] = (int) $Category->id;
                 $Feeds = Category::find($Category->id)->feeds;
                 if (!empty($Feeds)) {
                     $feed_ids = [];
                     foreach ($Feeds as $Feed) {
                         array_push($feed_ids, $Feed->id);
                     }
                     $feeds_groups[$key]['feed_ids'] = implode(',', $feed_ids);
                 }
             }
         }
         $response_arr['feeds_groups'] = $feeds_groups;
         $arr = array_merge($arr, $response_arr);
     }
     //return list with all unread article id's
     if (isset($_GET['unread_item_ids'])) {
         $unread_item_ids = [];
         $Articles = Article::where('status', 'unread')->orderBy('id', 'asc')->get();
         if (!empty($Articles)) {
             foreach ($Articles as $Article) {
                 array_push($unread_item_ids, $Article->id);
             }
         }
         //string/comma-separated list of positive integers instead of array
         $stack = implode(',', $unread_item_ids);
         $unreaditems = ['unread_item_ids' => $stack];
         $arr = array_merge($arr, $unreaditems);
     }
     //return string/comma-separated list with id's from read and starred articles
     if (isset($_GET['saved_item_ids'])) {
         $saved_item_ids = [];
         $Articles = Article::where('star_ind', '1')->orderBy('id', 'asc')->get();
         if (!empty($Articles)) {
             foreach ($Articles as $Article) {
                 array_push($saved_item_ids, $Article->id);
             }
         }
         //string/comma-separated list of positive integers instead of array
         $stack = implode(',', $saved_item_ids);
         $saveditems = ['saved_item_ids' => $stack];
         $arr = array_merge($arr, $saveditems);
     }
     //when argument is items, return 50 articles at a time
     if (isset($_GET['items'])) {
         $total_items = [];
         $total_items['total_items'] = Article::count();
         $arr = array_merge($arr, $total_items);
         $items = [];
         //request specific items, a maximum of 50 specific items requested by comma-separated argument
         if (isset($_GET['with_ids'])) {
             //list with id's is comma-separated, so transform to array
             $ArrayIds = explode(',', $_REQUEST['with_ids']);
             //create empty array to store Article results
             $Articles = [];
             if (!empty($ArrayIds)) {
//.........這裏部分代碼省略.........
開發者ID:rafix82,項目名稱:rssmonster,代碼行數:101,代碼來源:FeverController.php

示例9: getApiarticlelist

 /**
  * 獲取文章列表  -- ajax
  * 
  * @param		
  * 
  * @author		wen.zhou@bioon.com
  * 
  * @date		2015-10-25 11:45:44
  * 
  * @return		
  */
 public function getApiarticlelist()
 {
     /*獲取參數*/
     $draw = request('draw', 1);
     $start = request('start', 0);
     $length = request('length', 10);
     $search = request('search.value', '');
     /*獲取菜單*/
     $obj_article = new Article();
     $count = $obj_article->count();
     /*搜索*/
     if (!empty($search)) {
         $obj_article = $obj_article::where('name', 'like', '%{$search}%');
     }
     /*條數*/
     if ($length != -1) {
         $obj_article = $obj_article->offset($start)->limit($length);
     }
     $result_articles = $obj_article->get();
     $articles = $result_articles->toArray();
     foreach ($result_articles as $key => $result_article) {
         $articles[$key]['update'] = $this->current_user->can('update.articles');
         $articles[$key]['delete'] = $this->current_user->can('delete.articles');
     }
     $returnData = ["draw" => $draw, "recordsTotal" => $count, "recordsFiltered" => $count, 'data' => $articles];
     return response()->json($returnData);
 }
開發者ID:xezw211,項目名稱:laravel-blog-project,代碼行數:38,代碼來源:ArticleController.php

示例10: index

 public function index()
 {
     $count = ['articles' => Article::count(), 'registrants' => Registrant::count(), 'users' => User::count(), 'messages' => Message::count()];
     return view('admin.dashboard', compact('count'));
 }
開發者ID:kobeuu,項目名稱:bpb-sf,代碼行數:5,代碼來源:AdminController.php

示例11: panel

 public function panel()
 {
     $articles = Article::orderBy('created_at', 'desc')->get();
     $count = Article::count();
     return view('admin', ['articles' => $articles, 'count' => $count]);
 }
開發者ID:MahamedGiire,項目名稱:DTT,代碼行數:6,代碼來源:ArticleController.php


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