/** * @param Collection $originalData * @return LengthAwarePaginator */ protected function createPaginator($originalData) { $perPage = property_exists($this, 'perPage') ? $this->perPage : 10; $paginatorPath = property_exists($this, 'paginatorPath') ? $this->paginatorPath : '/'; $currentPage = request()->query('page', 1); $p = new LengthAwarePaginator($originalData->forPage($currentPage, $perPage), count($originalData), $perPage); $p->setPath($paginatorPath); return $p; }