forPage($page, $perPage); $total = $total ?: $this->count(); $options += [ 'path' => LengthAwarePaginator::resolveCurrentPath(), 'pageName' => $pageName, ]; return new LengthAwarePaginator($results, $total, $perPage, $page, $options); }); } }