Skip to content

Commit

Permalink
Removed send_to as not required here
Browse files Browse the repository at this point in the history
  • Loading branch information
cannycookie committed Sep 10, 2023
1 parent 23c5327 commit 5598302
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 42 deletions.
1 change: 0 additions & 1 deletion database/factories/EmailTemplateFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function definition() {
'view' => config('filament-email-templates.default_view'),
'cc' => null,
'bcc' => null,
'send_to' => 'user',
'from' => ['email'=>$this->faker->email,'name'=>$this->faker->name],
'name' => $this->faker->name,
'preheader' => $this->faker->sentence,
Expand Down
1 change: 0 additions & 1 deletion database/migrations/create_email_templates_table.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ return new class extends Migration
$table->string('name', 191)->nullable()->comment('Friendly Name');
$table->string('view', 191)->default(config('filament-email-templates.default_view'))->comment('Blade Template to load into');
$table->json('from')->nullable()->comment('From address to override system default');
$table->string('send_to',191)->nullable()->comment('The Notifiable model class');
$table->json('cc')->nullable();
$table->json('bcc')->nullable();
$table->string('subject', 191)->nullable();
Expand Down
9 changes: 2 additions & 7 deletions database/seeders/EmailTemplateSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public function run() {
'from' => ['email'=>config('mail.from.address'),'name'=>config('mail.from.name')],
'name' => 'User Welcome Email',
'title' => 'Welcome to ##config.app.name##',
'send_to' => 'user',
'subject' => 'Welcome to ##config.app.name##',
'preheader' => 'Lets get you started',
'content' => "<p>Dear ##user.name##,</p>
Expand All @@ -26,7 +25,6 @@ public function run() {
[
'key' => 'user-request-reset',
'from' => ['email'=>config('mail.from.address'),'name'=>config('mail.from.name')],
'send_to' => 'user',
'name' => 'User Request Password Reset',
'title' => 'Reset your password',
'subject' => '##config.app.name## Password Reset',
Expand All @@ -43,7 +41,6 @@ public function run() {
[
'key' => 'user-password-reset-success',
'from' => ['email'=>config('mail.from.address'),'name'=>config('mail.from.name')],
'send_to' => 'user',
'name' => 'User Password Reset',
'title' => 'Password Reset Success',
'subject' => '##config.app.name## password has been reset',
Expand All @@ -55,7 +52,7 @@ public function run() {
[
'key' => 'user-locked-out',
'from' => ['email'=>config('mail.from.address'),'name'=>config('mail.from.name')],
'send_to' => 'user',

'name' => 'User Account Locked Out',
'title' => 'Account Locked',
'subject' => '##config.app.name## account has been locked',
Expand All @@ -69,7 +66,7 @@ public function run() {
[
'key' => 'user-verify-email',
'from' => ['email'=>config('mail.from.address'),'name'=>config('mail.from.name')],
'send_to' => 'user',

'name' => 'User Verify Email',
'title' => 'Verify your email',
'subject' => 'Verify your email with ##config.app.name##',
Expand All @@ -87,7 +84,6 @@ public function run() {
'from' => ['email'=>config('mail.from.address'),'name'=>config('mail.from.name')],
'name' => 'User Verified',
'title' => 'Verification Success',
'send_to' => 'user',
'subject' => 'Verification success for ##config.app.name##',
'preheader' => 'Verification success for ##config.app.name##',
'content' => "<p>Hi ##user.name##,</p>
Expand All @@ -99,7 +95,6 @@ public function run() {
'from' => ['email'=>config('mail.from.address'),'name'=>config('mail.from.name')],
'name' => 'User Logged In',
'title' => 'Login Success',
'send_to' => 'user',
'subject' => 'Login Success for ##config.app.name##',
'preheader' => 'Login Success for ##config.app.name##',
'content' => "<p>Hi ##user.name##,</p>
Expand Down
2 changes: 0 additions & 2 deletions src/Models/EmailTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* @property array $from
* @property string $name
* @property string $view
* @property string $send_to
* @property object $cc
* @property object $bcc
* @property string $subject
Expand Down Expand Up @@ -51,7 +50,6 @@ class EmailTemplate extends Model
'preheader',
'content',
'language',
'send_to',
];

/**
Expand Down
13 changes: 2 additions & 11 deletions src/Resources/EmailTemplateResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,14 @@ public static function form(Form $form): Form
TextInput::make('from.name')->default(config('mail.from.name'))
->label(__('vb-email-templates::email-templates.form-fields-labels.email-from-name'))
->string(),
]
),
Grid::make(['default' => 3, 'sm' => 1, 'md' => 3])
->schema(
[

Select::make('view')
->label(__('vb-email-templates::email-templates.form-fields-labels.template-view'))
->options($templates)
->default(current($templates))
->searchable()
->required(),
Select::make('send_to')
->label(__('vb-email-templates::email-templates.form-fields-labels.email-to'))
->options($recipients)
->default(current($recipients))
->searchable()
->required(),

Select::make(config('filament-email-templates.theme_table_name') . '_id')
->label(__('vb-email-templates::email-templates.form-fields-labels.theme'))
->relationship(name: 'theme', titleAttribute: 'name')
Expand Down
7 changes: 0 additions & 7 deletions tests/MailableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
'key' => 'user-welcome',
'name' => 'User Welcome Email',
'title' => 'Welcome to ##config.app.name##',
'send_to' => 'user',
'subject' => 'Welcome to ##config.app.name##',
'preheader' => 'Lets get you started',
'content' => "<p>Dear ##user.name##,</p>
Expand All @@ -38,7 +37,6 @@
EmailTemplate::factory()->create(
[
'key' => 'user-request-reset',
'send_to' => 'user',
'name' => 'User Request Password Reset',
'title' => 'Reset your password',
'subject' => '##config.app.name## Password Reset',
Expand Down Expand Up @@ -68,7 +66,6 @@
EmailTemplate::factory()->create(
[
'key' => 'user-password-reset-success',
'send_to' => 'user',
'name' => 'User Password Reset',
'title' => 'Password Reset Success',
'subject' => '##config.app.name## password has been reset',
Expand All @@ -91,7 +88,6 @@
EmailTemplate::factory()->create(
[
'key' => 'user-locked-out',
'send_to' => 'user',
'name' => 'User Account Locked Out',
'title' => 'Account Locked',
'subject' => '##config.app.name## account has been locked',
Expand All @@ -115,7 +111,6 @@
EmailTemplate::factory()->create(
[
'key' => 'user-verify-email',
'send_to' => 'user',
'name' => 'User Verify Email',
'title' => 'Verify your email',
'subject' => 'Verify your email with ##config.app.name##',
Expand Down Expand Up @@ -145,7 +140,6 @@
'key' => 'user-verified',
'name' => 'User Verified',
'title' => 'Verification Success',
'send_to' => 'user',
'subject' => 'Verification success for ##config.app.name##',
'preheader' => 'Verification success for ##config.app.name##',
'content' => "<p>Hi ##user.name##,</p>
Expand All @@ -167,7 +161,6 @@
'key' => 'user-login',
'name' => 'User Logged In',
'title' => 'Login Success',
'send_to' => 'user',
'subject' => 'Login Success for ##config.app.name##',
'preheader' => 'Login Success for ##config.app.name##',
'content' => "<p>Hi ##user.name##,</p>
Expand Down
14 changes: 3 additions & 11 deletions tests/ResourcesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
'view' => $newData->view,
'cc' => $newData->cc,
'bcc' => $newData->bcc,
'send_to' => $newData->send_to,
//'from' => $newData->from,
'name' => $newData->name,
'preheader' => $newData->preheader,
Expand All @@ -61,7 +60,6 @@
'view' => $storedData->data['view'],
'cc' => $storedData->data['cc'],
'bcc' => $storedData->data['bcc'],
'send_to' => $storedData->data['send_to'],
//'from' => $storedData->data['from'],
'name' => $storedData->data['name'],
'preheader' => $storedData->data['preheader'],
Expand Down Expand Up @@ -91,7 +89,6 @@
'view' => $newData->view,
'cc' => $newData->cc,
'bcc' => $newData->bcc,
'send_to' => $newData->send_to,
'from.email' => $newData->from['email'],
'from.name' => $newData->from['name'],
'name' => $newData->name,
Expand All @@ -110,7 +107,6 @@
'view' => $updatedData->data['view'],
'cc' => $updatedData->data['cc'],
'bcc' => $updatedData->data['bcc'],
'send_to' => $updatedData->data['send_to'],
'name' => $updatedData->data['name'],
'preheader' => $updatedData->data['preheader'],
'subject' => $updatedData->data['subject'],
Expand Down Expand Up @@ -178,7 +174,7 @@
'key' => 'user-welcome',
'name' => 'User Welcome Email',
'title' => 'Welcome to ##config.app.name##',
'send_to' => 'user',

'subject' => 'Welcome to ##config.app.name##',
'preheader' => 'Lets get you started',
'content' => "<p>Dear ##user.name##,</p>
Expand All @@ -201,7 +197,6 @@
$emailData = EmailTemplate::factory()->create(
[
'key' => 'user-request-reset',
'send_to' => 'user',
'name' => 'User Request Password Reset',
'title' => 'Reset your password',
'subject' => '##config.app.name## Password Reset',
Expand Down Expand Up @@ -232,7 +227,7 @@
$emailData = EmailTemplate::factory()->create(
[
'key' => 'user-password-reset-success',
'send_to' => 'user',

'name' => 'User Password Reset',
'title' => 'Password Reset Success',
'subject' => '##config.app.name## password has been reset',
Expand All @@ -258,7 +253,7 @@
$emailData = EmailTemplate::factory()->create(
[
'key' => 'user-locked-out',
'send_to' => 'user',

'name' => 'User Account Locked Out',
'title' => 'Account Locked',
'subject' => '##config.app.name## account has been locked',
Expand Down Expand Up @@ -286,7 +281,6 @@
$emailData = EmailTemplate::factory()->create(
[
'key' => 'user-verify-email',
'send_to' => 'user',
'name' => 'User Verify Email',
'title' => 'Verify your email',
'subject' => 'Verify your email with ##config.app.name##',
Expand Down Expand Up @@ -318,7 +312,6 @@
'key' => 'user-verified',
'name' => 'User Verified',
'title' => 'Verification Success',
'send_to' => 'user',
'subject' => 'Verification success for ##config.app.name##',
'preheader' => 'Verification success for ##config.app.name##',
'content' => "<p>Hi ##user.name##,</p>
Expand All @@ -344,7 +337,6 @@
'key' => 'user-login',
'name' => 'User Logged In',
'title' => 'Login Success',
'send_to' => 'user',
'subject' => 'Login Success for ##config.app.name##',
'preheader' => 'Login Success for ##config.app.name##',
'content' => "<p>Hi ##user.name##,</p>
Expand Down
1 change: 0 additions & 1 deletion tests/factories/EmailTemplateFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public function definition()
'view' => config('filament-email-templates.default_view'),
'cc' => null,
'bcc' => null,
'send_to' => 'user',
'from' => ['email' => $this->faker->email,'name' => $this->faker->name],
'name' => $this->faker->name,
'preheader' => $this->faker->sentence,
Expand Down
1 change: 0 additions & 1 deletion tests/migrations/create_email_templates_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public function up()
$table->string('name', 191)->nullable()->comment('Friendly Name');
$table->string('view', 191)->default(config('filament-email-templates.default_view'))->comment('Blade Template to load into');
$table->json('from')->nullable()->comment('From address to override system default');
$table->string('send_to', 191)->nullable()->comment('The Notifiable model class');
$table->json('cc')->nullable();
$table->json('bcc')->nullable();
$table->string('subject', 191)->nullable();
Expand Down

0 comments on commit 5598302

Please sign in to comment.