-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customizable notification email mailable #7
Customizable notification email mailable #7
Conversation
Perhaps adding the option in the config to override the subject? Or, if you want to take it a step further, create a custom mailable class. |
Nice PR! Creating a custom mailable class would be the nicest solution imo. Can you take a look at it, or do you want me to try? @CodeWithDennis |
I will take a look, i will let you know if i can pull it off today. |
@Baspa I'm not entirely sure if this will work because the Notification is supposed to return a |
Hmm according to the documentation it should be possible: https://laravel.com/docs/11.x/notifications#using-mailables
I'm going to think about the |
Oh nice find, i will refactor it. |
Maybe the user should make sure their mailable can accept the two factor code as argument? Then we could do something like this: public function toMail(object $notifiable): Mailable
{
$mailable = config('filament-two-factor-auth.mail_mailable') ?? SendTwoFactor::class;
$mail = new $mailable($this->getTwoFactorCode($notifiable));
$mail->to($notifiable->email);
return $mail
} |
That might work... The changes have been pushed. @Baspa |
Great! Code is looking good, thank you for your effort. I will merge it @CodeWithDennis |
Thanks! Maybe you could bring up the option to customize the email as a discussion or issue for a future feature. I can see that some people might want more control, even though they can already change the view. |
Since the email is sent through a notification, we couldn’t customize it when trying to publish the view because there wasn't one. I’ve added a new view for the email with a default layout (see screenshot). Let me know your thoughts or if you have any feedback.
Since the Blade view is a markdown file, we shouldn't format it, as that could cause it to break.
TLDR: Package users can now override the view