/** * Find all items. * * @return \Illuminate\Database\Eloquent\Collection */ public function findAll() { if (!empty($this->filter)) { $queries = $this->filter->getQueries(); if ($queries) { $this->withQueries($queries); } $page = $this->filter->getPage(); $pageName = $this->filter->getPageName(); $perPage = $this->filter->getPerPage(); $result = $this->query()->paginate($perPage, $this->columns, $pageName, $page); } elseif (!empty($this->perPage)) { $result = $this->query()->paginate($this->perPage, $this->columns, $this->pageName, $this->page); } else { $result = $this->query()->get($this->columns); } $this->reset(); return $result; }
/** * Get the current page number. * * @return int */ public function currentPage() { return $this->filter->getPage(); }