diff --git a/src/Exceptions/PageNameNotFoundExecption.php b/src/Exceptions/PageNameNotFoundExecption.php new file mode 100644 index 00000000..c8d8d1b1 --- /dev/null +++ b/src/Exceptions/PageNameNotFoundExecption.php @@ -0,0 +1,15 @@ +pageName ?? $this->name)) + { + throw new PageNameNotFoundException(static::class); + } + return $this->pageName ?? Str::slug($this->name) . 'Page'; + } + + public function previousPage($pageName = 'page') + { + parent::previousPage($this->getPageName()); + } + + public function nextPage($pageName = 'page') + { + parent::nextPage($this->getPageName()); + } + + public function gotoPage($page, $pageName = 'page'): void + { + parent::setPage($page, $this->getPageName()); + } + + public function resetPage($pageName = 'page') + { + parent::setPage(1, $this->getPageName()); + } + + public function getResultsProperty() + { + return $this->mapCallbacks( + $this->getQuery()->paginate($this->perPage, ['*'], $this->getPageName()) + ); + } +}