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


PHP Article::search方法代码示例

本文整理汇总了PHP中app\Article::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::search方法的具体用法?PHP Article::search怎么用?PHP Article::search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Article的用法示例。


在下文中一共展示了Article::search方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index(urlRequest $request)
 {
     //query
     if ($search = $request->query('q')) {
         $articles = Article::search($search)->orderBy('created_at', 'desc')->simplepaginate(18);
     } elseif ($search = $request->query('id')) {
         //查找伪id(photo)
         $search = \App\Article::where('photo', $search)->firstOrFail()->id;
         $articles = DB::table('articles')->where('id', '<=', $search)->orderBy('created_at', 'desc')->simplepaginate(18);
         //伪搜索结果
         $search = $request->query('id');
     } else {
         //DB::代替Article::
         $articles = DB::table('articles')->orderBy('created_at', 'desc')->simplepaginate(18);
     }
     //已经点赞{!!$articles->appends(Request::except('page'))->render()!!}
     //$f = DB::table('votes')->whereuser_id(Auth::user()->id)->lists('votable_id');
     //http://example.com/custom/url?page=N, you should pass custom/url to the setPath
     $articles->setPath('articles');
     //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,项目名称:phphub-laravel5.1,代码行数:25,代码来源:ArticlesController.php

示例2: index

 public function index(Request $request)
 {
     $arts = Article::search($request->title)->orderBy('id', 'DESC')->paginate(5);
     $arts->each(function ($arts) {
         $arts->category;
         $arts->user;
     });
     return view('admin.articles.index')->with('arts', $arts);
 }
开发者ID:gratereaux,项目名称:practicing-laravel,代码行数:9,代码来源:ArticlesController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $articles = Article::search($request->title)->desc()->paginado();
     $articles->each(function ($articles) {
         $articles->category;
         $articles->user;
     });
     return view('admin.articles.index')->with('articles', $articles);
 }
开发者ID:SanDroid77,项目名称:Blog-Laravel,代码行数:14,代码来源:ArticlesController.php

示例4: GIF

 public function GIF(urlRequest $request)
 {
     if ($search = $request->query('q')) {
         $articles = \App\Article::search($search)->where('type', '.mp4')->orderBy('created_at', 'desc')->simplepaginate(18);
     } elseif ($search = $request->query('id')) {
         $search = \App\Article::where('photo', $search)->firstOrFail()->id;
         $articles = DB::table('articles')->where('type', '.mp4')->where('id', '<=', $search)->orderBy('created_at', 'desc')->simplepaginate(18);
         $search = $request->query('id');
     } else {
         $articles = DB::table('articles')->where('type', '.mp4')->orderBy('created_at', 'desc')->simplepaginate(18);
     }
     $articles->setPath('GIF');
     $hotimgs = \App\Article::where('type', 'LIKE', "%jpg%")->orderBy('vote_count', 'desc')->take(10)->get();
     $hotreplies = \App\Reply::orderBy('vote_count', 'desc')->limit(10)->get();
     return view('articles.index', compact('articles', 'search', 'hotimgs', 'hotreplies'));
 }
开发者ID:stevejobsii,项目名称:gg,代码行数:16,代码来源:TagsController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $articles = Article::search($request->title)->orderBy('created_at', 'DESC')->paginate(8);
     return view('admin.articles.index', compact('articles'));
 }
开发者ID:JhonatanC,项目名称:laravelcodfa,代码行数:10,代码来源:ArticlesController.php


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