diff --git a/resources/views/bootstrap-5/per-page.blade.php b/resources/views/bootstrap-5/per-page.blade.php
index 7d2ffb2..6857109 100644
--- a/resources/views/bootstrap-5/per-page.blade.php
+++ b/resources/views/bootstrap-5/per-page.blade.php
@@ -1,5 +1,4 @@
@php
-$amounts = [10 => 10, 20 => 20, 50 => 50, 100 => 100, 500 => 500];
$selected_per_page = $per_page ?? request('per_page', get_setting('per_page'));
if (! in_array($selected_per_page, $amounts)) {
diff --git a/resources/views/material-admin-26/per-page.blade.php b/resources/views/material-admin-26/per-page.blade.php
index d67e8d9..646381f 100644
--- a/resources/views/material-admin-26/per-page.blade.php
+++ b/resources/views/material-admin-26/per-page.blade.php
@@ -1,5 +1,4 @@
@php
-$amounts = [10 => 10, 20 => 20, 50 => 50, 100 => 100, 500 => 500];
$selected_per_page = $per_page ?? request('per_page', get_setting('per_page'));
if (! in_array($selected_per_page, $amounts)) {
diff --git a/src/Views/Components/PerPage.php b/src/Views/Components/PerPage.php
index fad87c9..4fb6b0c 100644
--- a/src/Views/Components/PerPage.php
+++ b/src/Views/Components/PerPage.php
@@ -6,14 +6,19 @@ class PerPage extends Component
{
protected string $view = 'per-page';
+ public array $amounts;
+
/**
* Create a new component instance.
*
* @return void
*/
public function __construct(
+ array $amounts = [10 => 10, 20 => 20, 50 => 50, 100 => 100, 500 => 500],
string $framework = '',
- ) {
+ )
+ {
+ $this->amounts = $amounts;
parent::__construct($framework);
}
diff --git a/tests/Feature/PerPageTest.php b/tests/Feature/PerPageTest.php
new file mode 100644
index 0000000..ec8b993
--- /dev/null
+++ b/tests/Feature/PerPageTest.php
@@ -0,0 +1,62 @@
+setFrameworkBootstrap5();
+
+ $this->registerTestRoute('per-page')
+ ->visit('/per-page')
+ ->see('10')
+ ->see('20')
+ ->see('50')
+ ->see('100')
+ ->see('500');
+ }
+
+ /** @test */
+ public function it_can_see_the_custom_per_page_options_bs5()
+ {
+ $this->setFrameworkBootstrap5();
+
+ $this->withoutExceptionHandling();
+ $this->registerTestRoute('per-page-custom')
+ ->visit('/per-page-custom')
+ ->see('11')
+ ->see('22')
+ ->see('55');
+ }
+
+ /** @test */
+ public function it_can_see_the_default_per_page_options_material_admin_26()
+ {
+ $this->setFrameworkMaterialAdmin26();
+
+ $this->registerTestRoute('per-page')
+ ->visit('/per-page')
+ ->see('10')
+ ->see('20')
+ ->see('50')
+ ->see('100')
+ ->see('500');
+ }
+
+ /** @test */
+ public function it_can_see_the_custom_per_page_options_material_admin_26()
+ {
+ $this->setFrameworkMaterialAdmin26();
+
+ $this->withoutExceptionHandling();
+ $this->registerTestRoute('per-page-custom')
+ ->visit('/per-page-custom')
+ ->see('11')
+ ->see('22')
+ ->see('55');
+ }
+}
diff --git a/tests/TestSupport/views/per-page-custom.blade.php b/tests/TestSupport/views/per-page-custom.blade.php
new file mode 100644
index 0000000..7d7b285
--- /dev/null
+++ b/tests/TestSupport/views/per-page-custom.blade.php
@@ -0,0 +1 @@
+
diff --git a/tests/TestSupport/views/per-page.blade.php b/tests/TestSupport/views/per-page.blade.php
new file mode 100644
index 0000000..7408297
--- /dev/null
+++ b/tests/TestSupport/views/per-page.blade.php
@@ -0,0 +1 @@
+