This package for sebastienheyd/boilerplate
allows developers to manage
emails for their applications. It allows you to create layouts and then define editors who will only be able to edit
texts without being able to modify the layouts.
- In order to install Laravel Boilerplate Email Editor run :
composer require sebastienheyd/boilerplate-email-editor
- Then run :
php artisan migrate
You can go to the admin and start using the email management panel.
Before generating a layout, be aware that there is a default html layout provided with this package.
To generate a new layout, you can use the following artisan command :
php artisan email:layout {name}
This command will generate a new blade file in the resources/views/email-layouts
folder.
To change the default folder, change the value of layouts_path
in the email-editor
configuration file.
However, you must publish the configuration file in order to do so. To do this, use the following command:
php artisan vendor:publish --provider="Sebastienheyd\BoilerplateEmailEditor\ServiceProvider"
This package is provided with two permissions that can be used depending on the desired profile.
- Email development : to be reserved for developers, it allows to define the slug, the description and the layout.
- Email edition : for users who will be able to edit the content of emails.
Permissions and roles are manageable by default with sebastienheyd/boilerplate
In the editing of the content of an e-mail, you will find a "Insert a variable" button. This button allows you to insert a variable in the e-mail and make it uneditable.
However, you can also enter the variables by hand by framing them with [ and ].
Example : "Hello [first_name]"
use Sebastienheyd\BoilerplateEmailEditor\Models\Email;
// Setting data
$data = ['first_name' => 'John', 'last_name' => 'Doe'];
// Sending email by his slug
Email::findBySlug('my_slug')->send('email@tld.com', $data);
// Or by his id
Email::find(1)->send('email@tld.com', $data);
Version 7 has undergone a major upgrade, do not upgrade to this version without knowing what you are doing.