我用
$merchants = Merchant::selectRaw($query)->with(...)->whereHas(...)->where(...)->paginate(10);
现在,我想在将其传递给刀片之前pluck()
将此数据。这不起作用:
$collection = collect($merchants);
当我用
$merchants = Merchant::selectRaw($query)->with(...)->whereHas(...)->where(...)->get();
我可以$collection = collect($merchants);
毫无问题地使用,但分页肯定不起作用。
那么,在将分页数据传递给刀片之前,如何结合paginate()
或collect()
访问控制器中的分页数据?