/** * Display a listing of the resource based on a tag. * * @param $slug * * @return \Illuminate\View\View */ public function tag($slug) { $tag = $this->tags->findByField('slug', $slug)->first(); $posts = $tag->posts()->with(['author', 'tags'])->paginate(5); $tags = $this->tags->all(); return view('frontend.pages.blog.tag', compact('tag', 'posts', 'tags')); }
/** * Display a listing of the resource based on a tag. * * @param $slug * * @return \Illuminate\View\View */ public function tag($slug) { $tag = $this->tags->findByField('slug', $slug)->first(); $works = $tag->works()->paginate(5); return view('frontend.pages.works.tag', compact('tag', 'works')); }