欢迎各位兄弟 发布技术文章
这里的技术是共享的
public function index(){$ search = \ Request :: get('search'); $ pageRow = \ Request :: get('pageRow'); $ pageRow =($ pageRow)?$ pageRow:config('app.nbrPages.pageCnt');
//$createdRits = $this->model->getSubmittedRits('supervisor',$pageRow,$search);
$allEmpPeInfo = $this->model->getEmployePeInfo($pageRow,$search);
$currentPage = $allEmpPeInfo->currentPage;
$pageLimit = $allEmpPeInfo->perPage;
$showingStartCnt = ($pageLimit * ($currentPage-1))+1;
$showingTotalLimit =$allEmpPeInfo->total;
$showingEndLimit = $showingStartCnt+$pageLimit-1;
$showingEndLimit = ($showingEndLimit > $showingTotalLimit) ? $showingTotalLimit : $showingEndLimit;
$resultArr = array_merge(array('allEmpPeInfo' => $allEmpPeInfo), array('pageRow' => $pageRow), array('search' => $search) , array('pageRowsArr' => array(1,5,10,20,30,40,50)),array('currentPage' => $currentPage,'pageLimit' => $pageLimit, 'showingTotalLimit' => $showingTotalLimit,'showingStartCnt' => $showingStartCnt,'showingEndLimit' => $showingEndLimit));
return view('performanceevaluation/index',compact('resultArr'));
}
model.php
public function getEmployePeInfo($ pageRows = 2,$ searchkey =''){
$getEmpInfo = $this->cssritDb->table('css_emp_pe_info')
->select('css_emp_pe_info.employee_number','css_emp_pe_info.emp_first_name','css_emp_pe_info.emp_last_name','css_emp_pe_info.pay_title','css_emp_pe_info.branch_org_mem_nm','css_emp_pe_info.div_org_mem_nm','css_emp_pe_info.current_pe_start_date','css_emp_pe_info.current_pe_end_date','css_emp_pe_info.next_pe_start_date','css_emp_pe_info.next_pe_end_date','css_emp_pe_info.pe_type','css_emp_pe_info.pe_rating');
// return $getEmpInfo->get();
if($searchkey)
{
$getEmpInfo = $getEmpInfo->where("(css_emp_pe_info.employee_number LIKE '%$searchkey%' OR css_emp_pe_info.emp_first_name LIKE '%$searchkey%' OR css_emp_pe_info.emp_last_name LIKE '%$searchkey%' OR css_emp_pe_info.pay_title LIKE '%$searchkey%' OR css_emp_pe_info.branch_org_mem_nm LIKE '%$searchkey%' OR css_emp_pe_info.div_org_mem_nm LIKE '%$searchkey%')");
//$query = $query->where('css_rit_request_info.request_info_id','LIKE','%'.$searchkey.'%');
//$query = $query->orwhere('css_rit_request_info.employee_id','LIKE','%'.$searchkey.'%');
//$query = $query->orwhere('css_rit_request_info.employee_first_nm','LIKE','%'.$searchkey.'%');
//$query = $query->orwhere('css_rit_request_info.employee_last_nm','LIKE','%'.$searchkey.'%');
//$query = $query->orwhere('css_rit_req_wrk_sites_info.cur_status','LIKE','%'.$searchkey.'%');
}
return $getEmpInfo->paginate($pageRows);
}
view.php
@if($ resultArr [ 'pageRow']) @endif 围棋 <label>Row</label>
@if($resultArr['search'])
<input type="hidden" class="form-control" name='search' value= '{{ $resultArr['search'] }}'>
@endif
<select class="form-control" name="pageRow" id='pageRow'>
@for($j=0;$j<count($resultArr['pageRowsArr']);$j++)
<option value={{ $resultArr['pageRowsArr'][$j] }} {{ $resultArr['pageRowsArr'][$j] == $resultArr['pageRow'] ? 'selected' : '' }}>{{ $resultArr['pageRowsArr'][$j] }}</option>
@endfor
</select>
</div>
<!-- <button type="submit" class="btn btn-sm btn-primary">Actions</button> -->
</form>
</td>
</tr>
</table>
</div>
<!-- SEARCH END -->
@madala你必须调用该->currentPage()
方法来AbstractPaginator
扩展它LengthAwarePaginator
。快来看看这里该方法的代码。这将返回受保护的$currentPage
属性。
@craigpaul嗨,你能告诉我我必须做什么,因为我是这个框架的新工作。请...