【发布时间】:2019-09-24 11:04:16
【问题描述】:
我正在使用脚本进行 Laravel 分页。我想在 LengthAwarePaginator 中添加每页下拉选择,以便我可以根据脚本中的页面选择列出所有条目。 我的脚本:
public function index(Request $request){
$data = [];
$keyword = request('keyword','');
$applicationData = $this->ppObjAdmin->getBackOfficeApplications(['keyword' =>$keyword]);
$paginate =10;
$pageStart = request('page', 1);
$offSet = ($pageStart * $paginate) - $paginate;
$itemsForCurrentPage = array_slice($applicationData,$offSet, $paginate);
$journeyListData = new LengthAwarePaginator($itemsForCurrentPage , count($applicationData) , $paginate , Paginator::resolveCurrentPage() , ['path' => Paginator::resolveCurrentPath()]);
$data['journeyData'] = $journeyListData;
$data['searchKeyword'] = $keyword;
return view('admin.listing',$data);
}
下拉html:
<select class="page_limit pgination-select" onchange="page_limit(this)">
<option value="10" >10 Entries per page</option>
<option value="20 " >20 Entries per page</option>
<option value="30 " >30 Entries per page</option>
<option value="50">50 Entries per page</option>
</select>
</div>`enter code here`
请看附件链接问题显示更清楚。 http://prntscr.com/guto00
请在此脚本中提供帮助以进行下拉选择。
提前致谢!
【问题讨论】:
标签: php laravel pagination