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 Aug 30, 2024
2 parents 6be2046 + 2fcac9e commit e46b479
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/Models/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ public function getStatusAttribute(): string
return 'Pending';
}
}
}
}
17 changes: 5 additions & 12 deletions src/Resources/MailResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@
use Filament\Forms\Form;
use Filament\Tables\Table;
use Filament\Tables;
use Filament\Infolists\Infolist;
use Filament\Resources\Resource;
use Filament\Infolists\Components\Grid;
use Filament\Infolists\Components\Tabs;
use Filament\Tables\Actions\EditAction;
use Filament\Tables\Actions\ViewAction;
use Filament\Tables\Actions\ActionGroup;
use Filament\Forms\Components\FileUpload;
use Filament\Tables\Actions\DeleteAction;
use Illuminate\Database\Eloquent\Builder;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\Tabs;
use Filament\Infolists\Components\Tabs\Tab;
use Vormkracht10\FilamentMails\Models\Mail;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
use Filament\Resources\Resource;
use Vormkracht10\FilamentMails\Models\Mail;
use Vormkracht10\FilamentMails\Resources\MailResource\Pages\ListMails;

class MailResource extends Resource
Expand Down Expand Up @@ -234,7 +228,6 @@ public static function getPages(): array
];
}


private static function formatEmailAddress($state): string
{
if (empty($state)) {
Expand All @@ -243,7 +236,7 @@ private static function formatEmailAddress($state): string

$data = json_decode($state, true);

if (!is_array($data)) {
if (! is_array($data)) {
return (string) $state; // Return the original state if it's not valid JSON
}

Expand Down
16 changes: 8 additions & 8 deletions src/Resources/MailResource/Pages/ListMails.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Vormkracht10\FilamentMails\Resources\MailResource\Pages;

use Filament\Resources\Pages\ListRecords;
use Vormkracht10\FilamentMails\Resources\MailResource;
use Filament\Resources\Components\Tab;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Database\Eloquent\Builder;
use Vormkracht10\FilamentMails\Models\Mail;
use Vormkracht10\FilamentMails\Resources\MailResource;

class ListMails extends ListRecords
{
Expand All @@ -33,17 +33,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()),

Check failure on line 36 in src/Resources/MailResource/Pages/ListMails.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to an undefined method Illuminate\Database\Eloquent\Builder::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()),

Check failure on line 41 in src/Resources/MailResource/Pages/ListMails.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to an undefined method Illuminate\Database\Eloquent\Builder::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) {

Check failure on line 47 in src/Resources/MailResource/Pages/ListMails.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to an undefined method Illuminate\Database\Eloquent\Builder::softBounced().
$query->hardBounced();
});
Expand All @@ -52,7 +52,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()),

Check failure on line 55 in src/Resources/MailResource/Pages/ListMails.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to an undefined method Illuminate\Database\Eloquent\Builder::unsent().
];
}
}
}

0 comments on commit e46b479

Please sign in to comment.