laravel 帶條件的分頁查詢


laravel 帶條件的分頁查詢,

原文:http://blog.csdn.net/u011020900/article/details/52369094

bug:斷點查詢,點擊分頁,查詢條件消失。

思路:追加(appends)查詢條件

 1  $taskList = TaskList::where('assignedTo','=',$assignedTo)
 2 ->where($ary_where)->where($ary_where1)
 3 ->where($ary_where2)->orderBy('status_order','asc')
 4 ->orderBy('finishedDate','desc')->paginate(3);
 5        
 6         //分頁處理
 7         $page = isset($page)?$request['page']:1;
 8         $taskList = $taskList->appends(array(
 9             'title'=>$title,
10             'project'=>$project,
11             'status'=>$status,
12             'page'=>$page
13             //add more element if you have more search terms
14         ));

view頁面

<div style="margin: 0px" >{!! $taskList->links() !!}</div>

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM