Skip to content

Commit e1c92fa

Browse files
committed
refactor: rename package from filament-mails to mails with unified namespaces
Synced from monorepo. Includes: - Rename FilamentMails -> Mails across all classes, config, and facades - fix: add defensive check for mail_id in download view - fix: remove table aliasing in SuppressionResource for Filament v4 - fix: disable sorting on computed status column - fix: styling improvements
1 parent d7595b4 commit e1c92fa

File tree

27 files changed

+199
-193
lines changed

27 files changed

+199
-193
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
blank_issues_enabled: false
22
contact_links:
33
- name: Ask a question
4-
url: https://github.com/backstagephp/filament-mails/discussions/new?category=q-a
4+
url: https://github.com/backstagephp/mails/discussions/new?category=q-a
55
about: Ask the community for help
66
- name: Request a feature
7-
url: https://github.com/backstagephp/filament-mails/discussions/new?category=ideas
7+
url: https://github.com/backstagephp/mails/discussions/new?category=ideas
88
about: Share ideas for new features
99
- name: Report a security issue
10-
url: https://github.com/backstagephp/filament-mails/security/policy
10+
url: https://github.com/backstagephp/mails/security/policy
1111
about: Learn how to notify us for sensitive bugs

README.md

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Filament Mails
1+
# Mails
22

3-
[![Latest Version on Packagist](https://img.shields.io/packagist/v/backstage/filament-mails.svg?style=flat-square)](https://packagist.org/packages/backstage/filament-mails)
4-
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/backstagephp/filament-mails/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/backstagephp/filament-mails/actions?query=workflow%3Arun-tests+branch%3Amain)
5-
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/backstagephp/filament-mails/fix-php-code-styling.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/backstagephp/filament-mails/actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain)
6-
[![Total Downloads](https://img.shields.io/packagist/dt/backstage/filament-mails.svg?style=flat-square)](https://packagist.org/packages/backstage/filament-mails)
3+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/backstage/mails.svg?style=flat-square)](https://packagist.org/packages/backstage/mails)
4+
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/backstagephp/mails/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/backstagephp/mails/actions?query=workflow%3Arun-tests+branch%3Amain)
5+
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/backstagephp/mails/fix-php-code-styling.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/backstagephp/mails/actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain)
6+
[![Total Downloads](https://img.shields.io/packagist/dt/backstage/mails.svg?style=flat-square)](https://packagist.org/packages/backstage/mails)
77

88
## Nice to meet you, we're [Backstage](https://backstagephp.com)
99

1010
Hi! We are a web development agency from Nijmegen in the Netherlands and we use Laravel for everything: advanced websites with a lot of bells and whistles and large web applications.
1111

1212
## About the package
1313

14-
Filament Mails can collect everything you might want to track about the mails that has been sent by your Filament app. Common use cases are provided in this package:
14+
Mails can collect everything you might want to track about the mails that has been sent by your Filament app. Common use cases are provided in this package:
1515

1616
- Log all sent emails with only specific attributes
1717
- View all sent emails in the browser using the viewer
@@ -31,14 +31,14 @@ Email as a protocol is very error prone. Succesfull email delivery is not guaran
3131

3232
The package is built on top of [Laravel Mails](https://github.com/backstagephp/laravel-mails).
3333

34-
![Filament Mails](https://raw.githubusercontent.com/backstagephp/filament-mails/main/docs/filament-mails.jpeg)
34+
![Mails](https://raw.githubusercontent.com/backstagephp/mails/main/docs/mails.jpeg)
3535

3636
## Installation
3737

3838
You can install the package via composer:
3939

4040
```bash
41-
composer require backstage/filament-mails
41+
composer require backstage/mails
4242
```
4343

4444
You can publish and run the migrations with:
@@ -52,36 +52,35 @@ You can publish the config file with:
5252

5353
```bash
5454
php artisan vendor:publish --tag="mails-config"
55-
php artisan vendor:publish --tag="filament-mails-config"
5655
```
5756

5857
Optionally, you can publish the views using
5958

6059
```bash
61-
php artisan vendor:publish --tag="filament-mails-views"
60+
php artisan vendor:publish --tag="mails-views"
6261
```
6362

6463
Add the routes to the PanelProvider using the `routes()` method, like this:
6564

6665
```php
67-
use Backstage\FilamentMails\Facades\FilamentMails;
66+
use Backstage\FilamentMails\Facades\Mails;
6867

6968
public function panel(Panel $panel): Panel
7069
{
7170
return $panel
72-
->routes(fn () => FilamentMails::routes());
71+
->routes(fn () => Mails::routes());
7372
}
7473
```
7574

7675
Then add the plugin to your `PanelProvider`
7776

7877
```php
79-
use Backstage\FilamentMails\FilamentMailsPlugin;
78+
use Backstage\FilamentMails\MailsPlugin;
8079

8180
public function panel(Panel $panel): Panel
8281
{
8382
return $panel
84-
->plugin(FilamentMailsPlugin::make());
83+
->plugin(MailsPlugin::make());
8584
}
8685
```
8786

@@ -90,12 +89,12 @@ public function panel(Panel $panel): Panel
9089
Using the `canManageMails()` method, you can define which users have access to the mail resources/pages. Here's a comprehensive example that includes additional logic for flexibility:
9190

9291
```php
93-
use Backstage\FilamentMails\FilamentMailsPlugin;
92+
use Backstage\FilamentMails\MailsPlugin;
9493
use Illuminate\Support\Facades\Auth;
9594

9695
$panel
9796
->plugins([
98-
FilamentMailsPlugin::make()
97+
MailsPlugin::make()
9998
->canManageMails(function () {
10099
$user = Auth::user();
101100

@@ -122,14 +121,14 @@ This example demonstrates how to combine role-based and permission-based access
122121
If you want to protect the mail routes with your (tenant) middleware, you can do so by adding the routes to the `tenantRoutes`:
123122

124123
```php
125-
use Backstage\FilamentMails\FilamentMailsPlugin;
126-
use Backstage\FilamentMails\Facades\FilamentMails;
124+
use Backstage\FilamentMails\MailsPlugin;
125+
use Backstage\FilamentMails\Facades\Mails;
127126

128127
public function panel(Panel $panel): Panel
129128
{
130129
return $panel
131-
->plugin(FilamentMailsPlugin::make())
132-
->tenantRoutes(fn() => FilamentMails::routes());
130+
->plugin(MailsPlugin::make())
131+
->tenantRoutes(fn() => Mails::routes());
133132
}
134133
```
135134

@@ -138,7 +137,7 @@ public function panel(Panel $panel): Panel
138137
139138
### Configuration
140139

141-
Sometimes you want to customize the resource, like configuring which users or roles may access the resource. You can do this by overriding the `MailResource` or `EventResource` classes in the `filament-mails` config file. Make sure your custom resource extends the original resource.
140+
Sometimes you want to customize the resource, like configuring which users or roles may access the resource. You can do this by overriding the `MailResource` or `EventResource` classes in the `mails` config file. Make sure your custom resource extends the original resource.
142141

143142
```php
144143
return [
@@ -155,34 +154,34 @@ return [
155154
### List with all sent emails and statistics
156155

157156
The package provides a clear overview of all emails, including statistics and the ability to filter the data.
158-
![Filament Mails](https://raw.githubusercontent.com/backstagephp/filament-mails/main/docs/mails-list.png)
157+
![Mails](https://raw.githubusercontent.com/backstagephp/mails/main/docs/mails-list.png)
159158

160159
### Resending emails
161160

162161
You can resend emails to the same or another recipient(s). This is useful when your email has bounced and you want to resend it.
163-
![Filament Mails](https://raw.githubusercontent.com/backstagephp/filament-mails/main/docs/mail-resend.png)
162+
![Mails](https://raw.githubusercontent.com/backstagephp/mails/main/docs/mail-resend.png)
164163

165164
### Information
166165

167166
You can view all relevant information about the email, such as the subject, the body, the attachments, the from address, the to address(es), the cc address(es), the bcc address(es), the reply to address, metadata and much more.
168-
![Filament Mails](https://raw.githubusercontent.com/backstagephp/filament-mails/main/docs/mail-sender-information.png)
169-
![Filament Mails](https://raw.githubusercontent.com/backstagephp/filament-mails/main/docs/mail-statistics.png)
170-
![Filament Mails](https://raw.githubusercontent.com/backstagephp/filament-mails/main/docs/mail-events.png)
171-
![Filament Mails](https://raw.githubusercontent.com/backstagephp/filament-mails/main/docs/mail-attachments.png)
167+
![Mails](https://raw.githubusercontent.com/backstagephp/mails/main/docs/mail-sender-information.png)
168+
![Mails](https://raw.githubusercontent.com/backstagephp/mails/main/docs/mail-statistics.png)
169+
![Mails](https://raw.githubusercontent.com/backstagephp/mails/main/docs/mail-events.png)
170+
![Mails](https://raw.githubusercontent.com/backstagephp/mails/main/docs/mail-attachments.png)
172171

173172
### Preview email
174173

175174
The package provides a preview of the email. This is useful to quickly check if the email is correct.
176-
![Filament Mails](https://raw.githubusercontent.com/backstagephp/filament-mails/main/docs/mail-preview.png)
175+
![Mails](https://raw.githubusercontent.com/backstagephp/mails/main/docs/mail-preview.png)
177176

178177
We also provide the raw HTML and plain text of the email.
179-
![Filament Mails](https://raw.githubusercontent.com/backstagephp/filament-mails/main/docs/mail-raw-html.png)
178+
![Mails](https://raw.githubusercontent.com/backstagephp/mails/main/docs/mail-raw-html.png)
180179

181180
### Events
182181

183182
The package also logs all events that are fired when an email is sent. This is useful to track the email sending process.
184-
![Filament Mails](https://raw.githubusercontent.com/backstagephp/filament-mails/main/docs/events-list.png)
185-
![Filament Mails](https://raw.githubusercontent.com/backstagephp/filament-mails/main/docs/event-details.png)
183+
![Mails](https://raw.githubusercontent.com/backstagephp/mails/main/docs/events-list.png)
184+
![Mails](https://raw.githubusercontent.com/backstagephp/mails/main/docs/event-details.png)
186185

187186
## Testing
188187

bin/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ const defaultOptions = {
4646
compile({
4747
...defaultOptions,
4848
entryPoints: ['./resources/js/index.js'],
49-
outfile: './resources/dist/filament-mails.js',
49+
outfile: './resources/dist/mails.js',
5050
})

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "backstage/mails",
3-
"description": "Log sending mails and related events in a beautiful Filament UI.",
3+
"description": "View logged mails and events in a beautiful Filament UI.",
44
"keywords": [
55
"backstagephp",
66
"laravel",
7-
"filament-mails"
7+
"mails"
88
],
9-
"homepage": "https://github.com/backstagephp/filament-mails",
9+
"homepage": "https://github.com/backstagephp/mails",
1010
"support": {
11-
"issues": "https://github.com/backstagephp/filament-mails/issues",
12-
"source": "https://github.com/backstagephp/filament-mails"
11+
"issues": "https://github.com/backstagephp/mails/issues",
12+
"source": "https://github.com/backstagephp/mails"
1313
},
1414
"license": "MIT",
1515
"authors": [
@@ -36,12 +36,12 @@
3636
},
3737
"autoload": {
3838
"psr-4": {
39-
"Backstage\\FilamentMails\\": "src/"
39+
"Backstage\\Mails\\": "src/"
4040
}
4141
},
4242
"autoload-dev": {
4343
"psr-4": {
44-
"Backstage\\FilamentMails\\Tests\\": "tests/"
44+
"Backstage\\Mails\\Tests\\": "tests/"
4545
}
4646
},
4747
"scripts": {
@@ -62,10 +62,10 @@
6262
"extra": {
6363
"laravel": {
6464
"providers": [
65-
"Backstage\\FilamentMails\\FilamentMailsServiceProvider"
65+
"Backstage\\Mails\\MailsServiceProvider"
6666
],
6767
"aliases": {
68-
"FilamentMails": "Backstage\\FilamentMails\\Facades\\FilamentMails"
68+
"Mails": "Backstage\\Mails\\Facades\\Mails"
6969
}
7070
}
7171
},
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
use Backstage\FilamentMails\Resources\EventResource;
4-
use Backstage\FilamentMails\Resources\MailResource;
5-
use Backstage\FilamentMails\Resources\SuppressionResource;
3+
use Backstage\Mails\Resources\EventResource;
4+
use Backstage\Mails\Resources\MailResource;
5+
use Backstage\Mails\Resources\SuppressionResource;
66

77
return [
88
'resources' => [

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"private": true,
33
"type": "module",
44
"scripts": {
5-
"dev:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/filament-mails.css --postcss --watch",
5+
"dev:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/mails.css --postcss --watch",
66
"dev:scripts": "node bin/build.js --dev",
7-
"build:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/filament-mails.css --postcss --minify && npm run purge",
7+
"build:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/mails.css --postcss --minify && npm run purge",
88
"build:scripts": "node bin/build.js",
9-
"purge": "filament-purge -i resources/dist/filament-mails.css -o resources/dist/filament-mails.css -v 3.x",
9+
"purge": "filament-purge -i resources/dist/mails.css -o resources/dist/mails.css -v 3.x",
1010
"dev": "npm-run-all --parallel dev:*",
1111
"build": "npm-run-all build:*"
1212
},
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
@php
2+
$attachment = $getState();
3+
$mailId = is_object($attachment) ? $attachment->mail_id : null;
4+
@endphp
5+
6+
@if($mailId && $attachment)
17
<a type="button"
28
href="{{ route('filament.' . Filament\Facades\Filament::getCurrentPanel()->getId() . '.mails.attachment.download', [
39
'tenant' => Filament\Facades\Filament::getTenant(),
4-
'mail' => $getState()->mail_id,
5-
'attachment' => $getState()->id,
6-
'filename' => $getState()->filename,
10+
'mail' => $mailId,
11+
'attachment' => $attachment->id,
12+
'filename' => $attachment->filename,
713
]) }}"
814
class="rounded-md bg-white px-3.5 py-2.5 text-sm font-semibold cursor-pointer text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50">Download</a>
15+
@endif

src/Controllers/MailDownloadController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
namespace Backstage\FilamentMails\Controllers;
3+
namespace Backstage\Mails\Controllers;
44

5-
use Backstage\Mails\Models\MailAttachment;
5+
use Backstage\Mails\Laravel\Models\MailAttachment;
66
use Illuminate\Routing\Controller;
77
use Illuminate\Support\Facades\Config;
88

src/Controllers/MailPreviewController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
namespace Backstage\FilamentMails\Controllers;
3+
namespace Backstage\Mails\Controllers;
44

5-
use Backstage\Mails\Models\Mail;
5+
use Backstage\Mails\Laravel\Models\Mail;
66
use Illuminate\Http\Request;
77
use Illuminate\Routing\Controller;
88

0 commit comments

Comments
 (0)