Example #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $posts = $this->posts->with('author')->paginate(5);
     return view('frontend.pages.blog.index', compact('posts'));
 }
Example #2
0
 /**
  * Display the specified resource.
  *
  * @param string $slug
  *
  * @return \Illuminate\View\View
  */
 public function show($slug)
 {
     $post = $this->posts->with('tags')->findByField('slug', $slug)->first();
     $tags = $this->tags->all();
     return view('frontend.pages.blog.show', compact('post', 'tags'));
 }