dynamic email templates
This commit is contained in:
@ -109,6 +109,8 @@ class CoreV200 extends Migration
|
||||
$table->increments('id');
|
||||
$table->integer('company_id');
|
||||
$table->string('alias');
|
||||
$table->string('class');
|
||||
$table->string('name');
|
||||
$table->string('subject');
|
||||
$table->text('body');
|
||||
$table->text('params')->nullable();
|
||||
|
@ -27,23 +27,61 @@ class EmailTemplates extends Seeder
|
||||
$company_id = $this->command->argument('company');
|
||||
|
||||
$templates = [
|
||||
'invoice_new_customer',
|
||||
'invoice_remind_customer',
|
||||
'invoice_remind_admin',
|
||||
'invoice_recur_customer',
|
||||
'invoice_recur_admin',
|
||||
'invoice_payment_customer',
|
||||
'invoice_payment_admin',
|
||||
'bill_remind_admin',
|
||||
'bill_recur_admin',
|
||||
[
|
||||
'alias' => 'invoice_new_customer',
|
||||
'class' => 'App\Notifications\Sale\Invoice',
|
||||
'name' => 'settings.email.templates.invoice_new_customer',
|
||||
],
|
||||
[
|
||||
'alias' => 'invoice_remind_customer',
|
||||
'class' => 'App\Notifications\Sale\Invoice',
|
||||
'name' => 'settings.email.templates.invoice_remind_customer',
|
||||
],
|
||||
[
|
||||
'alias' => 'invoice_remind_admin',
|
||||
'class' => 'App\Notifications\Sale\Invoice',
|
||||
'name' => 'settings.email.templates.invoice_remind_admin',
|
||||
],
|
||||
[
|
||||
'alias' => 'invoice_recur_customer',
|
||||
'class' => 'App\Notifications\Sale\Invoice',
|
||||
'name' => 'settings.email.templates.invoice_recur_customer',
|
||||
],
|
||||
[
|
||||
'alias' => 'invoice_recur_admin',
|
||||
'class' => 'App\Notifications\Sale\Invoice',
|
||||
'name' => 'settings.email.templates.invoice_recur_admin',
|
||||
],
|
||||
[
|
||||
'alias' => 'invoice_payment_customer',
|
||||
'class' => 'App\Notifications\Portal\PaymentReceived',
|
||||
'name' => 'settings.email.templates.invoice_payment_customer',
|
||||
],
|
||||
[
|
||||
'alias' => 'invoice_payment_admin',
|
||||
'class' => 'App\Notifications\Portal\PaymentReceived',
|
||||
'name' => 'settings.email.templates.invoice_payment_admin',
|
||||
],
|
||||
[
|
||||
'alias' => 'bill_remind_admin',
|
||||
'class' => 'App\Notifications\Purchase\Bill',
|
||||
'name' => 'settings.email.templates.bill_remind_admin',
|
||||
],
|
||||
[
|
||||
'alias' => 'bill_recur_admin',
|
||||
'class' => 'App\Notifications\Purchase\Bill',
|
||||
'name' => 'settings.email.templates.bill_recur_admin',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($templates as $template) {
|
||||
EmailTemplate::create([
|
||||
'company_id' => $company_id,
|
||||
'alias' => $template,
|
||||
'subject' => trans('email_templates.' . $template . '.subject'),
|
||||
'body' => trans('email_templates.' . $template . '.body'),
|
||||
'alias' => $template['alias'],
|
||||
'class' => $template['class'],
|
||||
'name' => $template['name'],
|
||||
'subject' => trans('email_templates.' . $template['alias'] . '.subject'),
|
||||
'body' => trans('email_templates.' . $template['alias'] . '.body'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user