diff --git a/src/Filament/Resources/EmailResource.php b/src/Filament/Resources/EmailResource.php index 8872781..91467f5 100644 --- a/src/Filament/Resources/EmailResource.php +++ b/src/Filament/Resources/EmailResource.php @@ -106,7 +106,7 @@ public static function form(Form $form): Form ->label(__('filament-email::filament-email.created_at')), ])->columns(4), Fieldset::make('attachments') - ->hidden(fn(): bool => !config('filament-email.store_attachments')) + ->hidden(fn (): bool => ! config('filament-email.store_attachments')) ->label(__('filament-email::filament-email.attachments')) ->schema([ View::make('filament-email::attachments') @@ -151,7 +151,7 @@ public static function table(Table $table): Table ->icon('heroicon-o-eye') ->iconSize(IconSize::Medium) ->modalFooterActions( - fn($action): array => [ + fn ($action): array => [ $action->getModalCancelAction(), ]) ->fillForm(function ($record) { @@ -208,7 +208,7 @@ public static function table(Table $table): Table ->nestedRecursiveRules([ 'email', ]) - ->default(fn($record): array => !empty($record->to) ? explode(',', $record->to) : []) + ->default(fn ($record): array => ! empty($record->to) ? explode(',', $record->to) : []) ->required(), TagsInput::make('cc') ->label(__('filament-email::filament-email.cc')) @@ -216,21 +216,21 @@ public static function table(Table $table): Table ->nestedRecursiveRules([ 'email', ]) - ->default(fn($record): array => !empty($record->cc) ? explode(',', $record->cc) : []), + ->default(fn ($record): array => ! empty($record->cc) ? explode(',', $record->cc) : []), TagsInput::make('bcc') ->label(__('filament-email::filament-email.bcc')) ->placeholder(__('filament-email::filament-email.insert_multiple_email_placelholder')) ->nestedRecursiveRules([ 'email', ]) - ->default(fn($record): array => !empty($record->bcc) ? explode(',', $record->bcc) : []), + ->default(fn ($record): array => ! empty($record->bcc) ? explode(',', $record->bcc) : []), Toggle::make('attachments') ->label(__('filament-email::filament-email.add_attachments')) ->onColor('success') ->offColor('danger') ->inline(false) - ->disabled(fn($record): bool => empty($record->attachments)) - ->default(fn($record): bool => !empty($record->attachments)) + ->disabled(fn ($record): bool => empty($record->attachments)) + ->default(fn ($record): bool => ! empty($record->attachments)) ->required(), ]) ->action(function (Email $record, array $data) { @@ -257,10 +257,10 @@ public static function table(Table $table): Table ]) ->columns([ TextColumn::make('from') - ->prefix(__('filament-email::filament-email.from') . ': ') - ->suffix(fn(Email $record): string => !empty($record->attachments) ? ' (' . trans_choice('filament-email::filament-email.attachments_number', count($record->attachments)) . ')' : '') + ->prefix(__('filament-email::filament-email.from').': ') + ->suffix(fn (Email $record): string => ! empty($record->attachments) ? ' ('.trans_choice('filament-email::filament-email.attachments_number', count($record->attachments)).')' : '') ->label(__('filament-email::filament-email.header')) - ->description(fn(Email $record): string => Str::limit(__('filament-email::filament-email.to') . ': ' . $record->to, 40)) + ->description(fn (Email $record): string => Str::limit(__('filament-email::filament-email.to').': '.$record->to, 40)) ->searchable(), TextColumn::make('subject') ->label(__('filament-email::filament-email.subject')) @@ -339,9 +339,9 @@ public static function table(Table $table): Table foreach ($data as $field => $value) { if ($data[$field] ?? null) { if ($field === 'attachments') { - $indicators[$field] = __('filament-email::filament-email.' . $field) . ": " . ($value === 'yes' ? __('filament-email::filament-email.yes') : __('filament-email::filament-email.no')); + $indicators[$field] = __('filament-email::filament-email.'.$field).': '.($value === 'yes' ? __('filament-email::filament-email.yes') : __('filament-email::filament-email.no')); } else { - $indicators[$field] = __('filament-email::filament-email.' . $field) . ": $value"; + $indicators[$field] = __('filament-email::filament-email.'.$field).": $value"; } } } @@ -352,24 +352,24 @@ public static function table(Table $table): Table return $query ->when( $data['from'], - fn(Builder $query, $value): Builder => $query->where('from', 'like', "%$value%"), + fn (Builder $query, $value): Builder => $query->where('from', 'like', "%$value%"), ) ->when( $data['to'], - fn(Builder $query, $value): Builder => $query->where('to', 'like', "%$value%"), + fn (Builder $query, $value): Builder => $query->where('to', 'like', "%$value%"), ) ->when( $data['cc'], - fn(Builder $query, $value): Builder => $query->where('cc', 'like', "%$value%"), + fn (Builder $query, $value): Builder => $query->where('cc', 'like', "%$value%"), ) ->when( $data['bcc'], - fn(Builder $query, $value): Builder => $query->where('bcc', 'like', "%$value%"), + fn (Builder $query, $value): Builder => $query->where('bcc', 'like', "%$value%"), ) ->when( $data['attachments'], //JSON_LENGTH - fn(Builder $query, $value): Builder => $query->where(DB::raw('JSON_LENGTH(attachments)'), $value === 'yes' ? '>' : '=', 0), + fn (Builder $query, $value): Builder => $query->where(DB::raw('JSON_LENGTH(attachments)'), $value === 'yes' ? '>' : '=', 0), ) ->when( $data['created_at'], @@ -392,7 +392,7 @@ function (Builder $query, $value): Builder { ->paginationPageOptions(function (Table $table) { $options = config('filament-email.pagination_page_options'); - return !empty($options) && is_array($options) ? $options : $table->getPaginationPageOptions(); + return ! empty($options) && is_array($options) ? $options : $table->getPaginationPageOptions(); }); } @@ -408,7 +408,7 @@ public static function canAccess(): bool { $roles = config('filament-email.can_access.role', []); - if (method_exists(filament()->auth()->user(), 'hasRole') && !empty($roles)) { + if (method_exists(filament()->auth()->user(), 'hasRole') && ! empty($roles)) { return filament()->auth()->user()->hasRole($roles); } diff --git a/src/Providers/EmailMessageServiceProvider.php b/src/Providers/EmailMessageServiceProvider.php index a12bd7a..f8203c1 100644 --- a/src/Providers/EmailMessageServiceProvider.php +++ b/src/Providers/EmailMessageServiceProvider.php @@ -6,6 +6,7 @@ use Illuminate\Support\Facades\Event; use Illuminate\Support\ServiceProvider; use RickDBCN\FilamentEmail\Listeners\FilamentEmailLogger; + class EmailMessageServiceProvider extends ServiceProvider { public function boot(): void