diff --git a/packages/admin/src/Filament/Resources/OrderResource.php b/packages/admin/src/Filament/Resources/OrderResource.php index 871c2b1d22..b6380f963b 100644 --- a/packages/admin/src/Filament/Resources/OrderResource.php +++ b/packages/admin/src/Filament/Resources/OrderResource.php @@ -72,7 +72,6 @@ public static function getDefaultTable(Table $table): Table ]) ->filters(static::getTableFilters()) ->defaultSort('id', 'DESC') - ->paginated([10, 25, 50, 100]) ->selectCurrentPageOnly() ->deferLoading() ->poll('60s'); diff --git a/packages/admin/src/Filament/Resources/ProductResource/Pages/ListProducts.php b/packages/admin/src/Filament/Resources/ProductResource/Pages/ListProducts.php index 9846d55f9d..105ba6a5aa 100644 --- a/packages/admin/src/Filament/Resources/ProductResource/Pages/ListProducts.php +++ b/packages/admin/src/Filament/Resources/ProductResource/Pages/ListProducts.php @@ -91,11 +91,6 @@ public function getTabs(): array ]; } - protected function paginateTableQuery(Builder $query): Paginator - { - return $query->simplePaginate($this->getTableRecordsPerPage()); - } - public function getMaxContentWidth(): MaxWidth { return MaxWidth::Full; diff --git a/packages/admin/src/LunarPanelManager.php b/packages/admin/src/LunarPanelManager.php index 0445d61340..d9e51efa55 100644 --- a/packages/admin/src/LunarPanelManager.php +++ b/packages/admin/src/LunarPanelManager.php @@ -11,6 +11,7 @@ use Filament\Support\Colors\Color; use Filament\Support\Facades\FilamentColor; use Filament\Support\Facades\FilamentIcon; +use Filament\Tables\Table; use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse; use Illuminate\Cookie\Middleware\EncryptCookies; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; @@ -143,6 +144,12 @@ public function register(): self 'chartSecondary' => Color::Green, ]); + Table::configureUsing(function (Table $table): void { + $table + ->paginationPageOptions([10, 25, 50, 100]) + ->defaultPaginationPageOption(25); + }); + return $this; } diff --git a/packages/admin/src/Support/Pages/BaseListRecords.php b/packages/admin/src/Support/Pages/BaseListRecords.php index 2e978ec95a..42d2821b82 100644 --- a/packages/admin/src/Support/Pages/BaseListRecords.php +++ b/packages/admin/src/Support/Pages/BaseListRecords.php @@ -3,6 +3,7 @@ namespace Lunar\Admin\Support\Pages; use Filament\Resources\Pages\ListRecords; +use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Database\Eloquent\Builder; use Lunar\Base\Traits\Searchable; @@ -49,4 +50,9 @@ protected function applySearchToTableQuery(Builder $query): Builder return $query; } + + protected function paginateTableQuery(Builder $query): Paginator + { + return $query->paginate($this->getTableRecordsPerPage()); + } }