laravel 的 分页以及条件搜索后分页
2016-12-02 14:43
519 查看
//后台的数据查询 public function index(Request $request) { $tid = empty($request->input('tid'))?0:$request->input('tid'); $content = empty($request->input('content'))?"":$request->input('content'); if($tid==0) { $where=">"; } else { $where ="="; } $news = DB::table("content") ->join('title', 'title.tid', '=', 'content.tid') ->where("content.tid",$where,$tid) ->where('content','like',"%$content%") ->paginate(5); //新闻的分类 $title = DB::table("title")->get(); $news->tid=$tid; $news->content=$content; //新闻内容 return view("news",['title'=>$title,'news'=>$news]); } //前台分页数据渲染
{!! $news->appends(array('tid'=>$news->tid,'content'=>$news->content))->render() !!}
相关文章推荐
- Laravel 框架 ajax多条件搜索后 分页
- laravel中带有条件搜索的分页
- Laravel-ORM带条件搜索分页
- ASP.NET MVC分页【无搜索条件的分页设计】
- tp3.2中利用分页类进行分页(多条件搜索)
- Node.js、express、mongodb 实现分页查询、条件搜索
- 多条件查询以及分页存储过程(倒叙和顺序查询)
- 运用数据库来实现数据分页以及搜索问题
- 黑马程序员_学习日记49_618数据库开发及ADO.Net(多条件搜索、case…when…语句、索引Index、子查询、分页、Join语句)
- Lucene+ik的分页和多条件模糊交集搜索
- lucene的多个字段搜索以及分页并高亮显示
- laravel 按条件分页
- 菜鸟求助(关于多条件搜索分页存储过程的优化)
- SqlServer分页存储过程(多表查询,多条件排序),Repeater控件呈现数据以及分页
- 分页原理及搜索时带着条件的方法
- zend framework 分页 Zend_Paginator 分页搜索条件
- ExtJs 4 store 在分页时如何保持搜索条件不变
- compass 的多条件搜索排序加分页
- 动态多条件查询分页以及排序(一)--MVC与Entity Framework版url分页版
- Thinkphp搜索时首页分页和搜索页保持条件分页的方法