/** * 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')); }
/** * 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')); }