Recently i was working on a Laravel project and i needed to add some sales emails: Onboarding when someone registers, an e-mail when an order was placed. That kinds of things.
Now, that can be done easily from within Laravel itself, but you would have to create every e-mail manually. Instead i wanted this work to offload to the users who creates this kinds of e-mails. This project already uses Laravel Nova so it was an easy choice to use that interface.
Meet email on event
I thought this was a really good example to open source, so meet Laravel Nova Email On Event.
This package adds a resource to your Laravel Nova installation. This package scans the available events and let's you create e-mails which will be sent when that specific event occurs.
Events are quite common in an average Laravel installation. Heck, even Laravel has loads and loads events available. In this first version only your custom events are supported.
Now you can let your end users create powerful emails within minutes. This first version also supports the use of variables. You can use the events that are publicly available on your events. You only have to wrap them in { and }. You can do this for example:
Hello {$user->name} # Becomes: Hello John Doe
Installation
Installation is simple. Just open your project and run:
composer require michielgerritsen/laravel-nova-email-on-event
And run migrations:
php artisan migrate
And that's it. When you open Laravel Nova you will see a new tab in your resources list: Email Events. Here you can add new emails for each event your application has available. Whether someone signed up for your app, or you just shipped an order, an e-mail is quickly added.
Source code
You can find the source code on Github. You can also find it on Packagist and NovaPackages.com.
Want to respond?