我有一个问题,不知道如何解决它。我在网上搜索过,但仍然没有得到确切的答案。我要做的是对查询表或下面的查询进行分页。一切似乎都有效(至少我每页收到 20 个查询,但是我不知道如何显示链接()?
我将查询保存在 $thecusts 集合中并将其传递给视图。表和关系:员工-经销商(多对多)经销商-客户(一对多)客户-查询(一对多)。
所以我需要为有很多经销商的员工分页x查询。
任何人都可以帮忙吗?
$justch = $me->employeehasdealers()->get(['dealers.dealer_id','dealer','abbreviation']); //list of dealers assigned to auth employee
$justch2=$justch->load(['DealerHasInquiries'=>function($query){
$query->with('inquiriescomments:comments_inquiries_id,inquiry_id,employee_id,comments','inquiryspdl','inquiriescustomers:customer_id,customer')->paginate(20);
}]);
$thecusts = new Collection();
foreach ($justch2 as $just) {
$thecusts = $thecusts->merge($just->DealerHasInquiries);
}