Yab\Quarx\Repositories\BlogRepository::publishedAndPaginated PHP Method

publishedAndPaginated() public method

    public function publishedAndPaginated()
    {
        return Blog::orderBy('created_at', 'desc')->where('is_published', 1)->where('published_at', '<=', Carbon::now()->format('Y-m-d h:i:s'))->paginate(Config::get('quarx.pagination', 25));
    }

Usage Example

Beispiel #1
0
 /**
  * Display all Blog entries.
  *
  * @param int $id
  *
  * @return Response
  */
 public function all()
 {
     $blogs = $this->blogRepository->publishedAndPaginated();
     $tags = $this->blogRepository->allTags();
     if (empty($blogs)) {
         abort(404);
     }
     return view('quarx-frontend::blog.all')->with('tags', $tags)->with('blogs', $blogs);
 }