Skip to content

Commit 37e86a7

Browse files
committed
Check if is array
1 parent 37fff5c commit 37e86a7

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/Resources/SuppressionResource.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ public static function table(Table $table): Table
101101
->columns([
102102
Tables\Columns\TextColumn::make('to')
103103
->label(__('Email address'))
104-
->formatStateUsing(fn ($record) => key(json_decode($record->to ?? [])))
104+
->formatStateUsing(fn($record) => key(json_decode($record->to ?? [])))
105105
->searchable(['to']),
106106

107107
Tables\Columns\TextColumn::make('id')
108108
->label(__('Reason'))
109109
->badge()
110-
->formatStateUsing(fn ($record) => $record->type->value == EventType::COMPLAINED->value ? 'Complained' : 'Bounced')
111-
->color(fn ($record): string => match ($record->type->value == EventType::COMPLAINED->value) {
110+
->formatStateUsing(fn($record) => $record->type->value == EventType::COMPLAINED->value ? 'Complained' : 'Bounced')
111+
->color(fn($record): string => match ($record->type->value == EventType::COMPLAINED->value) {
112112
true => 'danger',
113113
default => 'gray',
114114
}),
@@ -117,17 +117,17 @@ public static function table(Table $table): Table
117117
->label(__('Occurred At'))
118118
->dateTime('d-m-Y H:i')
119119
->since()
120-
->tooltip(fn (MailEvent $record) => $record->occurred_at->format('d-m-Y H:i'))
120+
->tooltip(fn(MailEvent $record) => $record->occurred_at->format('d-m-Y H:i'))
121121
->sortable()
122122
->searchable(),
123123
])
124124
->actions([
125125
Tables\Actions\Action::make('unsuppress')
126126
->label(__('Unsuppress'))
127127
->action(function (MailEvent $record) {
128-
event(new MailUnsuppressed(key($record->to), $record->mail->mailer == 'smtp' && filled($record->mail->transport) ? $record->mail->transport : $record->mail->mailer, $record->mail->stream_id ?? null));
128+
event(new MailUnsuppressed(is_array($record->to) ? key($record->to) : $record->to, $record->mail->mailer == 'smtp' && filled($record->mail->transport) ? $record->mail->transport : $record->mail->mailer, $record->mail->stream_id ?? null));
129129
})
130-
->visible(fn ($record) => Provider::tryFrom($record->mail->mailer == 'smtp' && filled($record->mail->transport) ? $record->mail->transport : $record->mail->mailer)),
130+
->visible(fn($record) => Provider::tryFrom($record->mail->mailer == 'smtp' && filled($record->mail->transport) ? $record->mail->transport : $record->mail->mailer)),
131131

132132
Tables\Actions\ViewAction::make()
133133
->url(null)
@@ -136,7 +136,7 @@ public static function table(Table $table): Table
136136
->label(__('View'))
137137
->hiddenLabel()
138138
->tooltip(__('View'))
139-
->infolist(fn (Infolist $infolist) => EventResource::infolist($infolist)),
139+
->infolist(fn(Infolist $infolist) => EventResource::infolist($infolist)),
140140
]);
141141
}
142142

0 commit comments

Comments
 (0)