generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from mailcarrierapp/feat/reply-to
Accept a replyTo param
- Loading branch information
Showing
20 changed files
with
99 additions
and
10 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
database/migrations/2024_08_27_074130_add_replyto_to_logs_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration { | ||
public function up(): void | ||
{ | ||
Schema::table('logs', function (Blueprint $table) { | ||
$table->json('replyTo')->nullable(); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::table('logs', function (Blueprint $table) { | ||
$table->dropColumn('replyTo'); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1324,3 +1324,52 @@ | |
&& $mail->hasMetadata('meta2', 'value2'); | ||
}); | ||
}); | ||
|
||
it('accepts a replyTo as string', function () { | ||
Template::factory()->create([ | ||
'slug' => 'welcome', | ||
]); | ||
|
||
postJson(route('mailcarrier.send'), [ | ||
'enqueue' => false, | ||
'template' => 'welcome', | ||
'subject' => 'Welcome!', | ||
'recipient' => '[email protected]', | ||
'replyTo' => '[email protected]', | ||
])->assertOk(); | ||
|
||
Mail::assertSent(GenericMail::class, 1); | ||
Mail::assertSent(GenericMail::class, function (GenericMail $mail) { | ||
$mail->build(); | ||
|
||
return $mail->hasTo('[email protected]') | ||
&& $mail->hasSubject('Welcome!') | ||
&& $mail->hasReplyTo('[email protected]'); | ||
}); | ||
}); | ||
|
||
it('accepts a replyTo as object', function () { | ||
Template::factory()->create([ | ||
'slug' => 'welcome', | ||
]); | ||
|
||
postJson(route('mailcarrier.send'), [ | ||
'enqueue' => false, | ||
'template' => 'welcome', | ||
'subject' => 'Welcome!', | ||
'recipient' => '[email protected]', | ||
'replyTo' => [ | ||
'email' => '[email protected]', | ||
'name' => 'Reply', | ||
], | ||
])->assertOk(); | ||
|
||
Mail::assertSent(GenericMail::class, 1); | ||
Mail::assertSent(GenericMail::class, function (GenericMail $mail) { | ||
$mail->build(); | ||
|
||
return $mail->hasTo('[email protected]') | ||
&& $mail->hasSubject('Welcome!') | ||
&& $mail->hasReplyTo('[email protected]', 'Reply'); | ||
}); | ||
}); |