Skip to content

v5.1.18

@markvaneijk markvaneijk tagged this 04 Aug 13:51
The mail preview threw `Route [filament.{panel-id}.mails.preview] not
defined` because the package still required consumers to wire up
`Mails::routes()` in their own PanelProvider. Register them from
`MailsPlugin::register()` instead, which runs while the panel is being
configured — before Filament reads the panel's route closures when
loading its route file.

Registering them from `boot()` would be too late: `Plugin::boot()` runs
from the `SetUpPanel` middleware, after routing has already matched, so
the routes would never resolve and would fall outside the
`filament.{panel-id}.` name group.

Only one variant is registered per panel. Registering both
`authenticatedRoutes()` and `authenticatedTenantRoutes()` unconditionally
defines the routes twice under the same names, and the tenant-less
variant wins the name lookup — so a tenancy panel would generate
`/tenancy/mails/1/preview?tenant=1` instead of
`/tenancy/1/mails/1/preview`, losing the tenant segment.

The test panel providers no longer register the routes by hand, so the
existing security and tenancy suites now cover the plugin's own
registration.

Refs backstagephp/mails#77

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Assets 2
Loading