/**
  * 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];
 }
 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'));
 }
예제 #3
0
 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'));
 }