当前位置: 首页>>代码示例>>PHP>>正文


PHP Tag::articles方法代码示例

本文整理汇总了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);
 }
开发者ID:linuxssm,项目名称:l5essential,代码行数:15,代码来源:TagTransformer.php

示例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'));
 }
开发者ID:sriharsha-sammeta,项目名称:learn-laravel-5.2,代码行数:8,代码来源:TagsController.php

示例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'));
 }
开发者ID:stevejobsii,项目名称:gg,代码行数:18,代码来源:TagsController.php

示例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'));
 }
开发者ID:Ravend6,项目名称:laravel_learn,代码行数:12,代码来源:TagsController.php

示例5: show

 public function show(Tag $tag)
 {
     $articles = $tag->articles()->published()->get();
     return view('articles.index', compact('articles'));
 }
开发者ID:nikolaynizruhin,项目名称:Laravel5Blog,代码行数:5,代码来源:TagsController.php

示例6: show

 public function show(Tag $tags)
 {
     $articles = $tags->articles()->published()->get();
     return view("articles.index", compact("articles"));
 }
开发者ID:Aetheus,项目名称:tutorials-and-exercises,代码行数:5,代码来源:TagsController.php

示例7: show

 /**
  * @param Tag $tag
  * @return Tag
  */
 public function show(Tag $tag)
 {
     $articles = $tag->articles()->published()->get();
     return view('articles.index')->with(['articles' => $articles]);
 }
开发者ID:buys-fran,项目名称:laravel5,代码行数:9,代码来源:TagsController.php

示例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'));
 }
开发者ID:khanhpnk,项目名称:hocvet,代码行数:11,代码来源:TagController.php

示例9: show

 public function show(Tag $tag)
 {
     return $tag->articles()->published()->get();
     // Preco nefunguje?
 }
开发者ID:smartedge,项目名称:Laravel,代码行数:5,代码来源:TagsController.php

示例10: show

 public function show(Tag $tag)
 {
     $articles = $tag->articles()->orderBy('created_at')->get();
     return view('articles.index', compact('articles'));
 }
开发者ID:rkang30,项目名称:newdev_L5.1,代码行数:5,代码来源:TagsController.php

示例11: show

 public function show(Tag $tag)
 {
     $articles = $tag->articles()->where('is_visible', true)->latest()->paginate(10);
     return view('tag.show', compact('articles', 'tag'));
 }
开发者ID:Ravend6,项目名称:laravel_base_v5.2,代码行数:5,代码来源:TagController.php

示例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'));
 }
开发者ID:maherelgamil,项目名称:ketabat,代码行数:11,代码来源:TagsController.php

示例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());
 }
开发者ID:hongpyo,项目名称:l5essential,代码行数:14,代码来源:TagTransformer.php

示例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);
 }
开发者ID:rudbast,项目名称:laravel-tutorial,代码行数:11,代码来源:TagsController.php


注:本文中的app\Tag::articles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。