Replies: 1 comment
-
|
Great idea, I implemented it in v3.0.14 (#88) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Support associating Eloquent models when sending notifications (not just Mailables), using a first-class API.
Problem
The package has a great
AssociatesModelstrait for Mailables, but in notification flows (Notification::toMail()returningMailMessage) the DX is unclear and currently requires workarounds.In practice, teams often send core business emails via notifications and want those mails linked to domain models (e.g.
Sale,Claim,Estimate) so they can view delivery/open/click status in UI tooling.Current Behavior
Mailable + AssociatesModels.MailMessage) has no obvious package-native equivalent.Proposal
Add a package-native notification message class, e.g.:
New fluent method:
Internally, this should reuse the existing association header strategy (
X-Mails-Associated-Models) soStoreMailRelationscontinues to work unchanged.Example Usage
Why This Approach
Suggested Tests
Add an integration test covering the full notification flow:
AssociatedMailMessageand callsassociateModels([...])mailsrecord is createdmailablespivot record is created linking the model(s) to the mailThis validates:
end-to-end.
Extra
Happy to open a PR with:
AssociatedMailMessageBeta Was this translation helpful? Give feedback.
All reactions