From b03b6b7e908e1b64a5a3da3c484e80f21fefe216 Mon Sep 17 00:00:00 2001 From: Rick de Boer Date: Wed, 16 Aug 2023 08:53:01 +0200 Subject: [PATCH 1/2] add defaultSort config option --- config/filament-email.php | 2 ++ src/Filament/Resources/EmailResource.php | 1 + 2 files changed, 3 insertions(+) diff --git a/config/filament-email.php b/config/filament-email.php index 777cb09..553ab24 100644 --- a/config/filament-email.php +++ b/config/filament-email.php @@ -6,6 +6,8 @@ 'resource' => [ 'group' => null, 'sort' => null, + 'default_sort_column' => 'created_at', + 'default_sort_direction' => 'desc' ], 'keep_email_for_days' => 60, diff --git a/src/Filament/Resources/EmailResource.php b/src/Filament/Resources/EmailResource.php index 0639ee5..8d6a6e3 100644 --- a/src/Filament/Resources/EmailResource.php +++ b/src/Filament/Resources/EmailResource.php @@ -85,6 +85,7 @@ public static function form(Form $form): Form public static function table(Table $table): Table { return $table + ->defaultSort(config('filament-email.resource.default_sort_column'), config('filament-email.resource.default_sort_direction')) ->actions([ Action::make('resend') ->label(__('Send again')) From a253d5093c844691cad0ce9939ef985a2d727060 Mon Sep 17 00:00:00 2001 From: RickDBCN Date: Wed, 16 Aug 2023 06:53:37 +0000 Subject: [PATCH 2/2] Fix styling --- config/filament-email.php | 2 +- tests/EmailModelTest.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/filament-email.php b/config/filament-email.php index 553ab24..57db24c 100644 --- a/config/filament-email.php +++ b/config/filament-email.php @@ -7,7 +7,7 @@ 'group' => null, 'sort' => null, 'default_sort_column' => 'created_at', - 'default_sort_direction' => 'desc' + 'default_sort_direction' => 'desc', ], 'keep_email_for_days' => 60, diff --git a/tests/EmailModelTest.php b/tests/EmailModelTest.php index ee88f0b..2965fe5 100644 --- a/tests/EmailModelTest.php +++ b/tests/EmailModelTest.php @@ -2,12 +2,13 @@ use Faker\Factory; use Illuminate\Support\Facades\Mail; +use RickDBCN\FilamentEmail\Filament\Resources\EmailResource\Pages\ListEmails; +use RickDBCN\FilamentEmail\Models\Email; + use function Pest\Laravel\assertDatabaseCount; use function Pest\Laravel\assertModelExists; use function Pest\Livewire\livewire; use function PHPUnit\Framework\assertEquals; -use RickDBCN\FilamentEmail\Filament\Resources\EmailResource\Pages\ListEmails; -use RickDBCN\FilamentEmail\Models\Email; it('can create an Email model', function () { $emailModel = Email::factory()->create();