From 6f93c66e2441aa4d1d396d5004e4ee889b2e57ee Mon Sep 17 00:00:00 2001 From: elegasoft Date: Tue, 9 Aug 2022 16:27:40 -0700 Subject: [PATCH 1/4] Create PageNameNotFoundExecptio Handles the condition of a $pageName or $name not being supplied for use as a query string --- src/Exceptions/PageNameNotFoundExecp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/Exceptions/PageNameNotFoundExecp diff --git a/src/Exceptions/PageNameNotFoundExecp b/src/Exceptions/PageNameNotFoundExecp new file mode 100644 index 00000000..b47dc9ac --- /dev/null +++ b/src/Exceptions/PageNameNotFoundExecp @@ -0,0 +1,16 @@ + Date: Tue, 9 Aug 2022 16:29:49 -0700 Subject: [PATCH 2/4] Rename PageNameNotFoundExecp to PageNameNotFoundExecption --- .../{PageNameNotFoundExecp => PageNameNotFoundExecption} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/Exceptions/{PageNameNotFoundExecp => PageNameNotFoundExecption} (100%) diff --git a/src/Exceptions/PageNameNotFoundExecp b/src/Exceptions/PageNameNotFoundExecption similarity index 100% rename from src/Exceptions/PageNameNotFoundExecp rename to src/Exceptions/PageNameNotFoundExecption From c9a8d876ecb185cfe71380bde18e221cd0915392 Mon Sep 17 00:00:00 2001 From: elegasoft Date: Tue, 9 Aug 2022 16:30:26 -0700 Subject: [PATCH 3/4] Create WithMultiTablePaginator --- src/Traits/WithMultiTablePaginator | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/Traits/WithMultiTablePaginator diff --git a/src/Traits/WithMultiTablePaginator b/src/Traits/WithMultiTablePaginator new file mode 100644 index 00000000..a48c5040 --- /dev/null +++ b/src/Traits/WithMultiTablePaginator @@ -0,0 +1,49 @@ +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()) + ); + } +} From e6e560b909d1a4f19fd1754b5cbfa5d542850b9f Mon Sep 17 00:00:00 2001 From: Jason Cook Date: Wed, 10 Aug 2022 10:29:10 -0700 Subject: [PATCH 4/4] Remove PHPStorm specific use statement --- .../{PageNameNotFoundExecption => PageNameNotFoundExecption.php} | 1 - 1 file changed, 1 deletion(-) rename src/Exceptions/{PageNameNotFoundExecption => PageNameNotFoundExecption.php} (87%) diff --git a/src/Exceptions/PageNameNotFoundExecption b/src/Exceptions/PageNameNotFoundExecption.php similarity index 87% rename from src/Exceptions/PageNameNotFoundExecption rename to src/Exceptions/PageNameNotFoundExecption.php index b47dc9ac..c8d8d1b1 100644 --- a/src/Exceptions/PageNameNotFoundExecption +++ b/src/Exceptions/PageNameNotFoundExecption.php @@ -3,7 +3,6 @@ namespace Mediconesystems\LivewireDatatables\Exceptions; use Exception; -use JetBrains\PhpStorm\Internal\LanguageLevelTypeAware; class PageNameNotFoundException extends Exception {