当union遇到paginate时,自定义分页
$agentInfo = $agentInfo->union($agentInfo2)->orderBy('AllScore','desc')->get();
$page = $request->get('page',1);
$collection = new Collection($agentInfo);
$perPage = 20;
$currentData = $collection->slice(($page-1)*$perPage,$perPage)->all();
$result = new LengthAwarePaginator($currentData,count($collection),$perPage);
$path = url()->current();
$result->setPath($path);

首页 我的博客
粤ICP备17103704号