示例#1
0
 /**
  * Get all of the posts for a given tag.
  *
  * @param Tag $tag
  * @param array $params
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function forTag(Tag $tag, $params = [])
 {
     return $tag->posts()->queryWithParams($params)->get();
 }
示例#2
0
 public function show(Tag $tag)
 {
     $posts = $tag->posts()->latest()->published();
     $posts->setPath($tag->name);
     return view('post.index', $posts);
 }
示例#3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show(Tag $tag)
 {
     $posts = $tag->posts()->get();
     //=$tag->posts()->published()->get() ??
     return view('posts.tags', compact('posts'));
 }