Database Newsletters
Database Newsletters
If you want to store signups to the database, you can publish a migration for the table
php artisan vendor:publish --tag enso-newsletter-migration
Crud
You can also add a crud support for this. By default, your crud will have filters for email and type (but type is only shown if you register more than one type of form). It also provides a default Download CSV action.
Publish the config and update the option
enable_admintotrueinenso/newsletter.phpAdd crud routes
EnsoNewsletter::crudRoutes();
Default Handler
To store Signup forms to the database, you can use or customise the provided Yadda\Enso\Newsletter\Handlers\DatabaseHandler.
By default, this assumes there will be a valid email field provided. Any additional fields will be stored in full into the data json column.
Customization
If you need to create a handler that performs this along with other actions, there is a trait which provides basic Database saving Yadda\Enso\Newsletter\Traits\WriteNewsletterToDatabase.
You may pass arguments to crudRoutes, as it defers to the standard EnsoCrud::crudRoutes()
EnsoNewsletter::crudRoutes($path, $crud_name, $name);
You can update the Crud MenuItem in the published config file enso/newsletter.php
You can edit the Crud definition in the published config file enso/crud/ensonewsletter.php