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


PHP Photo::count方法代码示例

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


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

示例1: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $recordsPerPage = 3;
     $offset = ($this->page - 1) * $recordsPerPage;
     $count = Photo::count();
     if ($this->page > 1) {
         $previousPage = $this->page - 1;
     } else {
         $previousPage = null;
     }
     if ($this->page * $recordsPerPage < $count) {
         $nextPage = $this->page + 1;
     } else {
         $nextPage = null;
     }
     $photos = Photo::orderBy('posted_date', 'desc')->skip($offset)->take($recordsPerPage)->get();
     //$previousUrl = action('PhotosController@index', ['page' => $previousPage]);
     //$nextUrl = action('PhotosController@index', ['page' => $nextPage]);
     if ($previousPage) {
         $previousUrl = url('photos/display/' . $previousPage);
     } else {
         $previousUrl = null;
     }
     if ($nextPage) {
         $nextUrl = url('photos/display/' . $nextPage);
     } else {
         $nextUrl = null;
     }
     return ['photos' => $photos, 'previousUrl' => $previousUrl, 'nextUrl' => $nextUrl];
 }
开发者ID:BobHumphrey,项目名称:tumblr-photos,代码行数:35,代码来源:CreatePhotosPager.php

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

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


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