$current_page = $request->get('page')?$request->get('page'):1;//当前页数
public function getChild($tel, $child_name, $current_page)
{
$where = [];//多条件搜索
if (!empty($tel)) {
$where['parent_tel'] = $tel;
}
if (!empty($child_name)) {
$where['child_name'] = $child_name;
}
$data = $this->ChildDao->getChild($where);
$perPage = config('const.page.page'); //每页显示数量
$item = array_slice($data, ($current_page - 1) * $perPage, $perPage);//$Array为要分页的数组
$totals = count($data);
$paginator = new LengthAwarePaginator($item, $totals, $perPage, $current_page, [
'path' => Paginator::resolveCurrentPath(),
'pageName' => 'page',
]);
Paginator::useBootstrap();
return $paginator;
}
02-09
1036
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交