diff --git a/src/Resources/EventResource.php b/src/Resources/EventResource.php index d266ed7..c17dd5b 100644 --- a/src/Resources/EventResource.php +++ b/src/Resources/EventResource.php @@ -69,7 +69,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 => 'clicked', WebhookEventType::OPEN => 'success', @@ -113,7 +113,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')) @@ -140,7 +140,7 @@ public static function infolist(Infolist $infolist): Infolist ->default(__('Unknown')) ->label(__('Link')) ->limit(50) - ->url(fn($state) => $state) + ->url(fn ($state) => $state) ->openUrlInNewTab(), TextEntry::make('tag') ->default(__('Unknown')) @@ -188,7 +188,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', @@ -200,7 +200,7 @@ public static function table(Table $table): Table }) ->searchable(), Tables\Columns\TextColumn::make('mail.subject') - ->url(fn(MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.view', $record->mail)) + ->url(fn (MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.view', $record->mail)) ->label(__('Subject')) ->searchable(['subject', 'payload']), Tables\Columns\TextColumn::make('occurred_at') @@ -235,4 +235,4 @@ public static function getPages(): array 'view' => ViewEvent::route('/{record}/view'), ]; } -} \ No newline at end of file +} diff --git a/src/Resources/MailResource.php b/src/Resources/MailResource.php index 67ef24e..c537ca6 100644 --- a/src/Resources/MailResource.php +++ b/src/Resources/MailResource.php @@ -81,22 +81,22 @@ public static function infolist(Infolist $infolist): Infolist ->label(__('Subject')), TextEntry::make('from') ->label(__('From')) - ->formatStateUsing(fn($state) => self::formatEmailAddress($state)), + ->formatStateUsing(fn ($state) => self::formatEmailAddress($state)), TextEntry::make('to') ->label(__('Recipient')) - ->formatStateUsing(fn($state) => self::formatEmailAddress($state)), + ->formatStateUsing(fn ($state) => self::formatEmailAddress($state)), TextEntry::make('cc') ->label(__('CC')) ->default('-') - ->formatStateUsing(fn($state) => self::formatEmailAddress($state)), + ->formatStateUsing(fn ($state) => self::formatEmailAddress($state)), TextEntry::make('bcc') ->label(__('BCC')) ->default('-') - ->formatStateUsing(fn($state) => self::formatEmailAddress($state)), + ->formatStateUsing(fn ($state) => self::formatEmailAddress($state)), TextEntry::make('reply_to') ->default('-') ->label(__('Reply To')) - ->formatStateUsing(fn($state) => self::formatEmailAddress($state)), + ->formatStateUsing(fn ($state) => self::formatEmailAddress($state)), ]), ]), Tab::make(__('Statistics')) @@ -149,8 +149,8 @@ public static function infolist(Infolist $infolist): Infolist TextEntry::make('type') ->label(__('Type')) ->badge() - ->url(fn(MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.events.view', $record)) - ->color(fn(WebhookEventType $state): string => match ($state) { + ->url(fn (MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.events.view', $record)) + ->color(fn (WebhookEventType $state): string => match ($state) { WebhookEventType::DELIVERY => 'success', WebhookEventType::CLICK => 'clicked', WebhookEventType::OPEN => 'success', @@ -161,7 +161,7 @@ public static function infolist(Infolist $infolist): Infolist return ucfirst($state->value); }), TextEntry::make('occurred_at') - ->url(fn(MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.events.view', $record)) + ->url(fn (MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.events.view', $record)) ->since() ->dateTimeTooltip('d-m-Y H:i') ->label(__('Occurred At')), @@ -187,7 +187,7 @@ public static function infolist(Infolist $infolist): Infolist ->hiddenLabel() ->label(__('HTML Content')) ->extraAttributes(['class' => 'overflow-x-auto']) - ->formatStateUsing(fn(string $state, Mail $record): View => view( + ->formatStateUsing(fn (string $state, Mail $record): View => view( 'filament-mails::mails.preview', ['html' => $state, 'mail' => $record], )), @@ -197,7 +197,7 @@ public static function infolist(Infolist $infolist): Infolist TextEntry::make('html') ->hiddenLabel() ->extraAttributes(['class' => 'overflow-x-auto']) - ->formatStateUsing(fn(string $state, Mail $record): View => view( + ->formatStateUsing(fn (string $state, Mail $record): View => view( 'filament-mails::mails.html', ['html' => $state, 'mail' => $record], )) @@ -238,7 +238,7 @@ public static function infolist(Infolist $infolist): Infolist ->label(__('Mime Type')), ViewEntry::make('uuid') ->label(__('Download')) - ->getStateUsing(fn($record) => $record) + ->getStateUsing(fn ($record) => $record) ->view('filament-mails::mails.download'), ]), ]), @@ -257,7 +257,7 @@ public static function table(Table $table): Table ->label(__('Status')) ->sortable() ->badge() - ->color(fn(string $state): string => match ($state) { + ->color(fn (string $state): string => match ($state) { 'Hard Bounced' => 'danger', 'Soft Bounced' => 'warning', 'Complained' => 'danger', @@ -277,27 +277,27 @@ public static function table(Table $table): Table Tables\Columns\IconColumn::make('attachments') ->label('') ->alignLeft() - ->getStateUsing(fn(Mail $record) => $record->attachments->count() > 0) - ->icon(fn(string $state): string => $state ? 'heroicon-o-paper-clip' : ''), + ->getStateUsing(fn (Mail $record) => $record->attachments->count() > 0) + ->icon(fn (string $state): string => $state ? 'heroicon-o-paper-clip' : ''), Tables\Columns\TextColumn::make('to') ->label(__('Recipient')) ->limit(50) - ->formatStateUsing(fn($state) => self::formatEmailAddressForTable($state)) + ->formatStateUsing(fn ($state) => self::formatEmailAddressForTable($state)) ->sortable() ->searchable(), Tables\Columns\TextColumn::make('opens') ->label(__('Opens')) - ->tooltip(fn(Mail $record) => __('Last opened at :date', ['date' => $record->last_opened_at?->format('d-m-Y H:i')])) + ->tooltip(fn (Mail $record) => __('Last opened at :date', ['date' => $record->last_opened_at?->format('d-m-Y H:i')])) ->sortable(), Tables\Columns\TextColumn::make('clicks') ->label(__('Clicks')) - ->tooltip(fn(Mail $record) => __('Last clicked at :date', ['date' => $record->last_clicked_at?->format('d-m-Y H:i')])) + ->tooltip(fn (Mail $record) => __('Last clicked at :date', ['date' => $record->last_clicked_at?->format('d-m-Y H:i')])) ->sortable(), Tables\Columns\TextColumn::make('sent_at') ->label(__('Sent At')) ->dateTime('d-m-Y H:i') ->since() - ->tooltip(fn(Mail $record) => $record->sent_at?->format('d-m-Y H:i')) + ->tooltip(fn (Mail $record) => $record->sent_at?->format('d-m-Y H:i')) ->sortable() ->searchable(), ]) @@ -418,4 +418,4 @@ private static function formatEmailAddressForTable($state): string return implode(', ', array_keys($data)); } -} \ No newline at end of file +}