Skip to content

Commit 081179b

Browse files
authored
[Fix] Hardcoded MailAttachment model should be replaced by config (#44)
* Use the MailAttachment model from the mails config * Fix styling * Remove non existing path check * Fix undefined property --------- Co-authored-by: Baspa <10845460+Baspa@users.noreply.github.com>
1 parent da83661 commit 081179b

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ parameters:
66
paths:
77
- src
88
- config
9-
- database
109
tmpDir: build/phpstan
1110
checkOctaneCompatibility: true
1211
checkModelProperties: true

src/Controllers/MailDownloadController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Vormkracht10\FilamentMails\Controllers;
44

55
use Illuminate\Routing\Controller;
6+
use Illuminate\Support\Facades\Config;
67
use Illuminate\Support\Facades\Storage;
7-
use Vormkracht10\Mails\Models\MailAttachment;
88

99
class MailDownloadController extends Controller
1010
{
@@ -17,8 +17,9 @@ public function __invoke(...$arguments)
1717
$tenant = null;
1818
}
1919

20-
/** @var MailAttachment $attachment */
21-
$attachment = MailAttachment::find($attachment);
20+
$attachmentModel = Config::get('mails.models.attachment');
21+
/** @var \Vormkracht10\Mails\Models\MailAttachment $attachment */
22+
$attachment = $attachmentModel::find($attachment);
2223

2324
$file = Storage::disk($attachment->disk)->path($attachment->storagePath);
2425

src/Resources/SuppressionResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public static function table(Table $table): Table
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(key($record->mail->to), $record->mail->mailer == 'smtp' && filled($record->mail->transport) ? $record->mail->transport : $record->mail->mailer, $record->mail->stream_id ?? null));
129129
})
130130
->visible(fn ($record) => Provider::tryFrom($record->mail->mailer == 'smtp' && filled($record->mail->transport) ? $record->mail->transport : $record->mail->mailer)),
131131

0 commit comments

Comments
 (0)