本文整理汇总了PHP中app\Tag::articles方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::articles方法的具体用法?PHP Tag::articles怎么用?PHP Tag::articles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Tag
的用法示例。
在下文中一共展示了Tag::articles方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: includeArticles
/**
* Include articles.
*
* @param \App\Tag $tag
* @param \League\Fractal\ParamBag|null $params
* @return \League\Fractal\Resource\Collection
* @throws \Exception
*/
public function includeArticles(Tag $tag, ParamBag $params = null)
{
$transformer = new \App\Transformers\ArticleTransformer($params);
$parsed = $this->getParsedParams();
$articles = $tag->articles()->limit($parsed['limit'])->offset($parsed['offset'])->orderBy($parsed['sort'], $parsed['order'])->get();
return $this->collection($articles, $transformer);
}
示例2: show
public function show(Tag $tag)
{
$articles = $tag->articles()->published('<')->get();
// if published date is not required then
// below line can be used :)
// $articles = $tag->articles
return view('articles.index', compact('articles'));
}
示例3: show
public function show(Tag $tag, urlRequest $request)
{
//query within tag
if ($search = $request->query('q')) {
$articles = $tag->articles()->search($search)->orderBy('created_at', 'desc')->simplepaginate(18);
} elseif ($search = $request->query('id')) {
$articles = $tag->articles()->where('id', '<', $search)->orderBy('created_at', 'desc')->simplepaginate(18);
} else {
//获取这个tag的articles并用articles.index反应
$articles = $tag->articles()->orderBy('created_at', 'desc')->simplepaginate(18);
}
$articles->setPath($tag->name);
//sidebar
$hotimgs = \App\Article::where('type', 'LIKE', "%jpg%")->orderBy('vote_count', 'desc')->take(10)->get();
//return $hotimgs;
$hotreplies = \App\Reply::orderBy('vote_count', 'desc')->limit(10)->get();
return view('articles.index', compact('articles', 'search', 'hotimgs', 'hotreplies'));
}
示例4: show
public function show(Tag $tag)
{
// if (Gate::denies('update', $tag)) {
// abort(403, Message::HTTP_403);
// }
// $this->authorize('update', $tag);
// if (auth()->user()->can('update', $tag)) {
// return 'You can';
// }
$articles = $tag->articles()->paginate(5);
return view('articles.index', compact('articles'));
}
示例5: show
public function show(Tag $tag)
{
$articles = $tag->articles()->published()->get();
return view('articles.index', compact('articles'));
}
示例6: show
public function show(Tag $tags)
{
$articles = $tags->articles()->published()->get();
return view("articles.index", compact("articles"));
}
示例7: show
/**
* @param Tag $tag
* @return Tag
*/
public function show(Tag $tag)
{
$articles = $tag->articles()->published()->get();
return view('articles.index')->with(['articles' => $articles]);
}
示例8: listArticles
/**
* Hiển thị thông tin bài viết theo tag
*
* @param Tag $tag
* @return Response
*/
public function listArticles(Tag $tag)
{
$articles = $tag->articles()->active()->orderBy('published_at', 'desc')->paginate(config('blog.record_per_page'));
return view('tags.list_articles', compact('tag', 'articles'));
}
示例9: show
public function show(Tag $tag)
{
return $tag->articles()->published()->get();
// Preco nefunguje?
}
示例10: show
public function show(Tag $tag)
{
$articles = $tag->articles()->orderBy('created_at')->get();
return view('articles.index', compact('articles'));
}
示例11: show
public function show(Tag $tag)
{
$articles = $tag->articles()->where('is_visible', true)->latest()->paginate(10);
return view('tag.show', compact('articles', 'tag'));
}
示例12: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show(Tag $tag)
{
$articles = $tag->articles()->get();
return view('tags.show', compact('tag', 'articles'));
}
示例13: includeArticles
/**
* Include articles.
*
* @param \App\Tag $tag
* @param \League\Fractal\ParamBag|null $params
* @return \League\Fractal\Resource\Collection
* @throws \Exception
*/
public function includeArticles(Tag $tag, ParamBag $params = null)
{
list($limit, $offset, $orderCol, $orderBy) = $this->calculateParams($params);
$articles = $tag->articles()->limit($limit)->offset($offset)->orderBy($orderCol, $orderBy)->get();
return $this->collection($articles, new \App\Transformers\ArticleTransformer());
}
示例14: show
/**
* Show articles related to tag
*
* @param Tag $tag
* @return Response
*/
public function show(Tag $tag)
{
$data['articles'] = $tag->articles()->published()->get();
return view('articles.index', $data);
}