Browse Source

评价列表 分页器

master
parent
commit
e38906a3c7
  1. 19
      app/Service/ServiceEvaluateService.php

19
app/Service/ServiceEvaluateService.php

@ -39,23 +39,8 @@ class ServiceEvaluateService implements ServiceEvaluateServiceInterface
{
$res = Db::table('lanzu_service_evaluate')
->where(['service_personnel_id' => $service_personnel_id])
->limit(4)
->get();
// return $res;
$currentPage = 1;
$perPage = 2;
// 这里根据 $currentPage 和 $perPage 进行数据查询,以下使用 Collection 代替
// $collection = new Collection([
// ['id' => 1, 'name' => 'Tom'],
// ['id' => 2, 'name' => 'Sam'],
// ['id' => 3, 'name' => 'Tim'],
// ['id' => 4, 'name' => 'Joe'],
// ]);
//
// $users = array_values($collection->forPage($currentPage, $perPage)->toArray());
return new Paginator($res, $perPage, $currentPage);
->paginate(4);
return $res;
}
}
Loading…
Cancel
Save