Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 1 addition & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,7 @@ Optionally, you can publish the views using
php artisan vendor:publish --tag="mails-views"
```

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

```php
use Backstage\Mails\Facades\Mails;

public function panel(Panel $panel): Panel
{
return $panel
->routes(fn () => Mails::routes());
}
```

Then add the plugin to your `PanelProvider`
Add the plugin to your `PanelProvider`

```php
use Backstage\Mails\MailsPlugin;
Expand Down Expand Up @@ -118,22 +106,6 @@ $panel

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.

### Tenant middleware and route protection

If you want to protect the mail routes with your (tenant) middleware, you can do so by adding the routes to the `tenantRoutes`:

```php
use Backstage\Mails\MailsPlugin;
use Backstage\Mails\Facades\Mails;

public function panel(Panel $panel): Panel
{
return $panel
->plugin(MailsPlugin::make())
->tenantRoutes(fn() => Mails::routes());
}
```

> [!IMPORTANT]
> 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.

Expand Down
4 changes: 3 additions & 1 deletion src/MailsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public function register(Panel $panel): void
config('mails.resources.mail', MailResource::class),
config('mails.resources.event', EventResource::class),
config('mails.resources.suppression', SuppressionResource::class),
]);
])
->routes(fn () => Mails::routes())
->tenantRoutes(fn () => Mails::routes());
}

public function boot(Panel $panel): void
Expand Down
Loading