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

tags() public method

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

Usage Example

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