You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+56-24Lines changed: 56 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
# Filament Mails
2
2
3
-
[](https://packagist.org/packages/vormkracht10/filament-mails)
[](https://packagist.org/packages/backstagephp/filament-mails)
## Nice to meet you, we're [Vormkracht10](https://vormkracht10.nl)
8
+
## Nice to meet you, we're [Backstage](https://backstagephp.com)
9
9
10
10
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.
11
11
@@ -29,16 +29,16 @@ Filament Mails can collect everything you might want to track about the mails th
29
29
30
30
Email as a protocol is very error prone. Succesfull email delivery is not guaranteed in any way, so it is best to monitor your email sending realtime. Using external services like Postmark, Mailgun or Resend email gets better by offering things like logging and delivery feedback, but it still needs your attention and can fail silently but horendously. Therefore we created Laravel Mails that fills in all the gaps.
31
31
32
-
The package is built on top of [Laravel Mails](https://github.com/vormkracht10/laravel-mails).
32
+
The package is built on top of [Laravel Mails](https://github.com/backstagephp/laravel-mails).
Add the routes to the PanelProvider using the `routes()` method, like this:
65
65
66
66
```php
67
-
use Vormkracht10\FilamentMails\Facades\FilamentMails;
67
+
use Backstage\FilamentMails\Facades\FilamentMails;
68
68
69
69
public function panel(Panel $panel): Panel
70
70
{
@@ -76,7 +76,7 @@ public function panel(Panel $panel): Panel
76
76
Then add the plugin to your `PanelProvider`
77
77
78
78
```php
79
-
use Vormkracht10\FilamentMails\FilamentMailsPlugin;
79
+
use Backstage\FilamentMails\FilamentMailsPlugin;
80
80
81
81
public function panel(Panel $panel): Panel
82
82
{
@@ -85,13 +85,45 @@ public function panel(Panel $panel): Panel
85
85
}
86
86
```
87
87
88
+
### Security
89
+
90
+
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:
91
+
92
+
```php
93
+
use Backstage\FilamentMails\FilamentMailsPlugin;
94
+
use Illuminate\Support\Facades\Auth;
95
+
96
+
$panel
97
+
->plugins([
98
+
FilamentMailsPlugin::make()
99
+
->canManageMails(function () {
100
+
$user = Auth::user();
101
+
102
+
// Allow access for users with specific roles
103
+
if ($user->hasRole('admin') || $user->hasRole('supervisor')) {
104
+
return true;
105
+
}
106
+
107
+
// Allow access for users with specific permissions
108
+
if ($user->hasPermissionTo('manage mails')) {
109
+
return true;
110
+
}
111
+
112
+
// Restrict access for all other users
113
+
return false;
114
+
}),
115
+
]);
116
+
```
117
+
118
+
This example demonstrates how to combine role-based and permission-based access control, providing a more robust and flexible approach to managing access to mail resources.
119
+
88
120
### Tenant middleware and route protection
89
121
90
122
If you want to protect the mail routes with your (tenant) middleware, you can do so by adding the routes to the `tenantRoutes`:
91
123
92
124
```php
93
-
use Vormkracht10\FilamentMails\FilamentMailsPlugin;
94
-
use Vormkracht10\FilamentMails\Facades\FilamentMails;
125
+
use Backstage\FilamentMails\FilamentMailsPlugin;
126
+
use Backstage\FilamentMails\Facades\FilamentMails;
95
127
96
128
public function panel(Panel $panel): Panel
97
129
{
@@ -102,7 +134,7 @@ public function panel(Panel $panel): Panel
102
134
```
103
135
104
136
> [!IMPORTANT]
105
-
> For setting up the webhooks to register mail events, please look into the README of [Laravel Mails](https://github.com/vormkracht10/laravel-mails), the underlying package that powers this package.
137
+
> For setting up the webhooks to register mail events, please look into the README of [Laravel Mails](https://github.com/backstagephp/laravel-mails), the underlying package that powers this package.
106
138
107
139
### Configuration
108
140
@@ -123,34 +155,34 @@ return [
123
155
### List with all sent emails and statistics
124
156
125
157
The package provides a clear overview of all emails, including statistics and the ability to filter the data.
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.
0 commit comments