//后台的数据查询 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 的 分页以及条件搜索后分页
最新推荐文章于 2024-07-17 11:11:26 发布