Database Newsletters
Database Newsletters
If you want to store signups to the database, you can publish a migration and config file for the table
php artisan vendor:publish --provider "Yadda\Enso\Newsletter\EnsoNewsletterServiceProvider" --tag enso-migration
You can make any alterations you need now, then run migrations
php artisan migrate
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 crud config file.
php artisan vendor:publish --provider "Yadda\Enso\Newsletter\EnsoNewsletterServiceProvider" --tag enso-configUpdate the option
enable_admintotrueinenso/newsletter.phpconfig file.Add 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);