Skip to content

Commit

Permalink
Merge branch 'main' of github.com:vormkracht10/filament-mails
Browse files Browse the repository at this point in the history
  • Loading branch information
Baspa committed Sep 27, 2024
2 parents b576367 + a1e6b65 commit a479db4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/Resources/EventResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function infolist(Infolist $infolist): Infolist
TextEntry::make('type')
->label(__('Type'))
->badge()
->color(fn(EventType $state): string => match ($state) {
->color(fn (EventType $state): string => match ($state) {
EventType::DELIVERED => 'success',
EventType::CLICKED => 'clicked',
EventType::OPENED => 'info',
Expand Down Expand Up @@ -123,7 +123,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'))
Expand Down Expand Up @@ -152,7 +152,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'))
Expand Down Expand Up @@ -201,7 +201,7 @@ public static function table(Table $table): Table
->label(__('Type'))
->sortable()
->badge()
->color(fn(EventType $state): string => match ($state) {
->color(fn (EventType $state): string => match ($state) {
EventType::DELIVERED => 'success',
EventType::CLICKED => 'clicked',
EventType::OPENED => 'info',
Expand All @@ -216,7 +216,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', [
->url(fn (MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.view', [
'record' => $record->mail,
'tenant' => filament()->getTenant()?->id,

Check failure on line 221 in src/Resources/EventResource.php

View workflow job for this annotation

GitHub Actions / phpstan

Access to an undefined property Illuminate\Database\Eloquent\Model::$id.
]))
Expand All @@ -226,7 +226,7 @@ public static function table(Table $table): Table
->label(__('Occurred At'))
->dateTime('d-m-Y H:i')
->since()
->tooltip(fn(MailEvent $record) => $record->occurred_at->format('d-m-Y H:i'))
->tooltip(fn (MailEvent $record) => $record->occurred_at->format('d-m-Y H:i'))
->sortable()
->searchable(),
])
Expand Down Expand Up @@ -254,4 +254,4 @@ public static function getPages(): array
'view' => ViewEvent::route('/{record}/view'),
];
}
}
}
14 changes: 7 additions & 7 deletions src/Resources/EventResource/Pages/ListEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,28 @@ public function getTabs(): array
->badgeColor('success')
->icon('heroicon-o-check-circle')
->badge(MailEvent::where('type', EventType::DELIVERED)->count())
->modifyQueryUsing(fn(Builder $query) => $query->where('type', EventType::DELIVERED)),
->modifyQueryUsing(fn (Builder $query) => $query->where('type', EventType::DELIVERED)),

'click' => Tab::make()
->label(__('Click'))
->badgeColor('clicked')
->icon('heroicon-o-cursor-arrow-rays')
->badge(MailEvent::where('type', EventType::CLICKED)->count())
->modifyQueryUsing(fn(Builder $query) => $query->where('type', EventType::CLICKED)),
->modifyQueryUsing(fn (Builder $query) => $query->where('type', EventType::CLICKED)),

'open' => Tab::make()
->label(__('Open'))
->badgeColor('info')
->icon('heroicon-o-envelope-open')
->badge(MailEvent::where('type', EventType::OPENED)->count())
->modifyQueryUsing(fn(Builder $query) => $query->where('type', EventType::OPENED)),
->modifyQueryUsing(fn (Builder $query) => $query->where('type', EventType::OPENED)),

'bounced' => Tab::make()
->label(__('Bounced'))
->badgeColor('danger')
->icon('heroicon-o-x-circle')
->badge(fn() => MailEvent::where('type', EventType::SOFT_BOUNCED)->count() + MailEvent::where('type', EventType::HARD_BOUNCED)->count())
->modifyQueryUsing(fn(Builder $query) => $query->where(function ($query) {
->badge(fn () => MailEvent::where('type', EventType::SOFT_BOUNCED)->count() + MailEvent::where('type', EventType::HARD_BOUNCED)->count())
->modifyQueryUsing(fn (Builder $query) => $query->where(function ($query) {
$query->where('type', EventType::SOFT_BOUNCED)
->orWhere('type', EventType::HARD_BOUNCED);
})),
Expand All @@ -68,7 +68,7 @@ public function getTabs(): array
->badgeColor('warning')
->icon('heroicon-o-exclamation-circle')
->badge(MailEvent::where('type', EventType::COMPLAINED)->count())
->modifyQueryUsing(fn(Builder $query) => $query->where('type', EventType::COMPLAINED)),
->modifyQueryUsing(fn (Builder $query) => $query->where('type', EventType::COMPLAINED)),
];
}
}
}

0 comments on commit a479db4

Please sign in to comment.