Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add defaultSort config option #10

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/filament-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
'resource' => [
'group' => null,
'sort' => null,
'default_sort_column' => 'created_at',
'default_sort_direction' => 'desc',
],

'keep_email_for_days' => 60,
Expand Down
1 change: 1 addition & 0 deletions src/Filament/Resources/EmailResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
5 changes: 3 additions & 2 deletions tests/EmailModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down