diff --git a/src/FilamentMailsServiceProvider.php b/src/FilamentMailsServiceProvider.php index ac926cf..2512a14 100644 --- a/src/FilamentMailsServiceProvider.php +++ b/src/FilamentMailsServiceProvider.php @@ -150,4 +150,4 @@ protected function getMigrations(): array 'create_filament-mails_table', ]; } -} \ No newline at end of file +} diff --git a/src/Resources/EventResource.php b/src/Resources/EventResource.php index 4f84d95..e539be5 100644 --- a/src/Resources/EventResource.php +++ b/src/Resources/EventResource.php @@ -2,17 +2,17 @@ namespace Vormkracht10\FilamentMails\Resources; -use Filament\Tables; -use Filament\Tables\Table; -use Filament\Infolists\Infolist; -use Filament\Resources\Resource; use Filament\Infolists\Components\Grid; -use Vormkracht10\Mails\Models\MailEvent; +use Filament\Infolists\Components\KeyValueEntry; use Filament\Infolists\Components\Section; use Filament\Infolists\Components\TextEntry; -use Vormkracht10\Mails\Enums\WebhookEventType; -use Filament\Infolists\Components\KeyValueEntry; +use Filament\Infolists\Infolist; +use Filament\Resources\Resource; +use Filament\Tables; +use Filament\Tables\Table; use Vormkracht10\FilamentMails\Resources\EventResource\Pages\ListEvents; +use Vormkracht10\Mails\Enums\WebhookEventType; +use Vormkracht10\Mails\Models\MailEvent; class EventResource extends Resource { @@ -64,7 +64,7 @@ public static function infolist(Infolist $infolist): Infolist TextEntry::make('type') ->label(__('Type')) ->badge() - ->color(fn(WebhookEventType $state): string => match ($state) { + ->color(fn (WebhookEventType $state): string => match ($state) { WebhookEventType::DELIVERY => 'success', WebhookEventType::CLICK => 'info', WebhookEventType::OPEN => 'success', @@ -105,7 +105,7 @@ public static function infolist(Infolist $infolist): Infolist ->default(__('Unknown')) ->label(__('User Agent')) ->limit(50) - ->tooltip(fn($state) => $state), + ->tooltip(fn ($state) => $state), ]), ]), Section::make(__('Location')) @@ -130,7 +130,7 @@ public static function infolist(Infolist $infolist): Infolist TextEntry::make('link') ->default(__('Unknown')) ->label(__('Link')) - ->url(fn($state) => $state) + ->url(fn ($state) => $state) ->openUrlInNewTab(), TextEntry::make('tag') ->default(__('Unknown')) @@ -152,7 +152,7 @@ public static function table(Table $table): Table ->label(__('Type')) ->sortable() ->badge() - ->color(fn(WebhookEventType $state): string => match ($state) { + ->color(fn (WebhookEventType $state): string => match ($state) { WebhookEventType::DELIVERY => 'success', WebhookEventType::CLICK => 'clicked', WebhookEventType::OPEN => 'success', @@ -197,4 +197,4 @@ public static function getPages(): array 'index' => ListEvents::route('/'), ]; } -} \ No newline at end of file +} diff --git a/src/Resources/EventResource/Pages/ListEvents.php b/src/Resources/EventResource/Pages/ListEvents.php index 536b215..358a438 100644 --- a/src/Resources/EventResource/Pages/ListEvents.php +++ b/src/Resources/EventResource/Pages/ListEvents.php @@ -3,11 +3,11 @@ namespace Vormkracht10\FilamentMails\Resources\EventResource\Pages; use Filament\Resources\Components\Tab; -use Vormkracht10\Mails\Models\MailEvent; use Filament\Resources\Pages\ListRecords; use Illuminate\Database\Eloquent\Builder; -use Vormkracht10\Mails\Enums\WebhookEventType; use Vormkracht10\FilamentMails\Resources\EventResource; +use Vormkracht10\Mails\Enums\WebhookEventType; +use Vormkracht10\Mails\Models\MailEvent; class ListEvents extends ListRecords { @@ -35,31 +35,31 @@ public function getTabs(): array ->label(__('Delivery')) ->icon('heroicon-o-check-circle') ->badge(MailEvent::where('type', WebhookEventType::DELIVERY)->count()) - ->modifyQueryUsing(fn(Builder $query) => $query->where('type', WebhookEventType::DELIVERY)), + ->modifyQueryUsing(fn (Builder $query) => $query->where('type', WebhookEventType::DELIVERY)), 'click' => Tab::make() ->label(__('Click')) ->icon('heroicon-o-cursor-arrow-rays') ->badge(MailEvent::where('type', WebhookEventType::CLICK)->count()) - ->modifyQueryUsing(fn(Builder $query) => $query->where('type', WebhookEventType::CLICK)), + ->modifyQueryUsing(fn (Builder $query) => $query->where('type', WebhookEventType::CLICK)), 'open' => Tab::make() ->label(__('Open')) ->icon('heroicon-o-envelope-open') ->badge(MailEvent::where('type', WebhookEventType::OPEN)->count()) - ->modifyQueryUsing(fn(Builder $query) => $query->where('type', WebhookEventType::OPEN)), + ->modifyQueryUsing(fn (Builder $query) => $query->where('type', WebhookEventType::OPEN)), 'bounce' => Tab::make() ->label(__('Bounce')) ->icon('heroicon-o-x-circle') ->badge(MailEvent::where('type', WebhookEventType::BOUNCE)->count()) - ->modifyQueryUsing(fn(Builder $query) => $query->where('type', WebhookEventType::BOUNCE)), + ->modifyQueryUsing(fn (Builder $query) => $query->where('type', WebhookEventType::BOUNCE)), 'complaint' => Tab::make() ->label(__('Complaint')) ->icon('heroicon-o-exclamation-circle') ->badge(MailEvent::where('type', WebhookEventType::COMPLAINT)->count()) - ->modifyQueryUsing(fn(Builder $query) => $query->where('type', WebhookEventType::COMPLAINT)), + ->modifyQueryUsing(fn (Builder $query) => $query->where('type', WebhookEventType::COMPLAINT)), ]; } -} \ No newline at end of file +} diff --git a/src/Resources/MailResource/Pages/ListMails.php b/src/Resources/MailResource/Pages/ListMails.php index fd66e89..b8e89f5 100644 --- a/src/Resources/MailResource/Pages/ListMails.php +++ b/src/Resources/MailResource/Pages/ListMails.php @@ -34,17 +34,17 @@ public function getTabs(): array ->label(__('Sent')) ->icon('heroicon-o-paper-airplane') ->badge(Mail::sent()->count()) - ->modifyQueryUsing(fn(Builder $query) => $query->sent()), + ->modifyQueryUsing(fn (Builder $query) => $query->sent()), 'delivered' => Tab::make() ->label(__('Delivered')) ->icon('heroicon-o-check-circle') ->badge(Mail::delivered()->count()) - ->modifyQueryUsing(fn(Builder $query) => $query->delivered()), + ->modifyQueryUsing(fn (Builder $query) => $query->delivered()), 'bounced' => Tab::make() ->label(__('Bounced')) ->icon('heroicon-o-x-circle') - ->badge(fn() => Mail::softBounced()->count() + Mail::hardBounced()->count()) - ->modifyQueryUsing(fn(Builder $query) => $query->where(function ($query) { + ->badge(fn () => Mail::softBounced()->count() + Mail::hardBounced()->count()) + ->modifyQueryUsing(fn (Builder $query) => $query->where(function ($query) { $query->softBounced()->orWhere(function ($query) { $query->hardBounced(); }); @@ -53,7 +53,7 @@ public function getTabs(): array ->label(__('Unsent')) ->icon('heroicon-o-x-circle') ->badge(Mail::unsent()->count()) - ->modifyQueryUsing(fn(Builder $query) => $query->unsent()), + ->modifyQueryUsing(fn (Builder $query) => $query->unsent()), ]; } @@ -63,4 +63,4 @@ protected function getHeaderWidgets(): array MailStatsWidget::class, ]; } -} \ No newline at end of file +} diff --git a/src/Widgets/MailStatsWidget.php b/src/Widgets/MailStatsWidget.php index 45990d2..d306eb3 100644 --- a/src/Widgets/MailStatsWidget.php +++ b/src/Widgets/MailStatsWidget.php @@ -12,7 +12,7 @@ class MailStatsWidget extends BaseWidget protected function getStats(): array { - $bouncedMails = Mail::where(fn($query) => $query->softBounced()->orWhere(fn($query) => $query->hardBounced()))->count(); + $bouncedMails = Mail::where(fn ($query) => $query->softBounced()->orWhere(fn ($query) => $query->hardBounced()))->count(); $openedMails = Mail::opened()->count(); $deliveredMails = Mail::delivered()->count(); $clickedMails = Mail::clicked()->count(); @@ -43,4 +43,4 @@ protected function getStats(): array return $widgets; } -} \ No newline at end of file +}